diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbbb5c5ba..6cb874f67 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,95 +18,95 @@ jobs: container: image: ghcr.io/kiracore/docker/base-image:v0.13.14 steps: - # Work around https://github.com/actions/checkout/issues/760 - - name: Add safe.directory - run: | - git config --global --add safe.directory /github/workspace - git config --global --add safe.directory $PWD - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - - name: Checking dependency versions & packaging source files - run: | - echo "(current dir): $PWD" && ls -l ./ - cd ../ && tar -czvf src.tar.gz -C ./sekai . && cp ./src.tar.gz ./sekai/src.tar.gz - cd ./sekai - . /etc/profile && echo "Utils Version: $(bash-utils bashUtilsVersion)" - go version - echo "ENVS: $(env)" - echo "HOME: $HOME" - echo " PWD: $PWD" - - name: Extract branch name on push - if: github.event_name == 'push' - shell: bash - run: | - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - - name: Extract branch name on pull request - if: github.event_name == 'pull_request' - env: - REF_BRANCH: ${{ github.event.pull_request.head.ref }} - BASE_REF_BRANCH: ${{ github.base_ref }} - shell: bash - run: | - echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - - name: Inspecting & organizing artifacts - run: | - echo "(current dir): $PWD" && ls -l ./ - chmod -Rv 555 ./scripts - RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV - RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV - REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV - git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - if [[ "$RELEASE_VER" =~ $VERSION_REGEX ]] && [[ "$SOURCE_BRANCH" =~ $VERSION_REGEX ]] && [ "$SOURCE_BRANCH" != "$RELEASE_VER" ] ; then - echo "ERROR: Version branch name MUST be the same as the app version, run scripts/version.sh to check app version!" - exit 1 - else - echo "INFO: Variables setup succeeded" - fi - - name: Print debug data before testing - run: | - echo " Source branch: ${{ env.SOURCE_BRANCH }}" - echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" - echo " Release branch: ${{ env.RELEASE_BRANCH }}" - echo " Event name: ${{ github.event_name }}" - echo " Repository name: ${{ env.REPOSITORY_NAME }}" - echo " Release version: ${{ env.RELEASE_VER }}" - echo " Release exists: ${{ env.RELEASE_EXISTS }}" - - name: Testing SEKAI - run: | - make test - make install - sekaid version - make test-local - - name: Publishing SEKAID binaries - shell: bash - run: | - make publish - touch ./RELEASE.md - cp -fv ./RELEASE.md ./bin/RELEASE.md - cp -fv ./src.tar.gz ./bin/source-code.tar.gz - chmod -Rv 777 ./bin - echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md - echo -e " Release Versions: $RELEASE_VER\n\r" >> ./bin/RELEASE.md - echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md - echo " sekai-darwin-amd64.deb: sha256:$(sha256sum ./bin/sekai-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " sekai-darwin-arm64.deb: sha256:$(sha256sum ./bin/sekai-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " sekai-linux-amd64.deb: sha256:$(sha256sum ./bin/sekai-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " sekai-linux-arm64.deb: sha256:$(sha256sum ./bin/sekai-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "sekai-windows-amd64.exe: sha256:$(sha256sum ./bin/sekai-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo "sekai-windows-arm64.exe: sha256:$(sha256sum ./bin/sekai-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " sekai-utils.sh: sha256:$(sha256sum ./bin/sekai-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo " sekai-env.sh: sha256:$(sha256sum ./bin/sekai-env.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md - echo -e "\`\`\`" >> ./bin/RELEASE.md - tar -czvf deb.tar.gz -C ./bin . - - name: Uploading artifacts - uses: actions/upload-artifact@v3.0.0 - with: - name: sekai-bin-deb - path: ./deb.tar.gz + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + - name: Checking dependency versions & packaging source files + run: | + echo "(current dir): $PWD" && ls -l ./ + cd ../ && tar -czvf src.tar.gz -C ./sekai . && cp ./src.tar.gz ./sekai/src.tar.gz + cd ./sekai + . /etc/profile && echo "Utils Version: $(bash-utils bashUtilsVersion)" + go version + echo "ENVS: $(env)" + echo "HOME: $HOME" + echo " PWD: $PWD" + - name: Extract branch name on push + if: github.event_name == 'push' + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + - name: Extract branch name on pull request + if: github.event_name == 'pull_request' + env: + REF_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_REF_BRANCH: ${{ github.base_ref }} + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV + - name: Inspecting & organizing artifacts + run: | + echo "(current dir): $PWD" && ls -l ./ + chmod -Rv 555 ./scripts + RELEASE_VER="$(./scripts/version.sh)" && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + if [[ "$RELEASE_VER" =~ $VERSION_REGEX ]] && [[ "$SOURCE_BRANCH" =~ $VERSION_REGEX ]] && [ "$SOURCE_BRANCH" != "$RELEASE_VER" ] ; then + echo "ERROR: Version branch name MUST be the same as the app version, run scripts/version.sh to check app version!" + exit 1 + else + echo "INFO: Variables setup succeeded" + fi + - name: Print debug data before testing + run: | + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo "Destination branch: ${{ env.DESTINATION_BRANCH }}" + echo " Release branch: ${{ env.RELEASE_BRANCH }}" + echo " Event name: ${{ github.event_name }}" + echo " Repository name: ${{ env.REPOSITORY_NAME }}" + echo " Release version: ${{ env.RELEASE_VER }}" + echo " Release exists: ${{ env.RELEASE_EXISTS }}" + - name: Testing SEKAI + run: | + make test + make install + sekaid version + make test-local + - name: Publishing SEKAID binaries + shell: bash + run: | + make publish + touch ./RELEASE.md + cp -fv ./RELEASE.md ./bin/RELEASE.md + cp -fv ./src.tar.gz ./bin/source-code.tar.gz + chmod -Rv 777 ./bin + echo -e "\n\r\n\r\`\`\`" >> ./bin/RELEASE.md + echo -e " Release Versions: $RELEASE_VER\n\r" >> ./bin/RELEASE.md + echo -e " Release Date Time: $(date --rfc-2822)" >> ./bin/RELEASE.md + echo " sekai-darwin-amd64.deb: sha256:$(sha256sum ./bin/sekai-darwin-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " sekai-darwin-arm64.deb: sha256:$(sha256sum ./bin/sekai-darwin-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " sekai-linux-amd64.deb: sha256:$(sha256sum ./bin/sekai-linux-amd64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " sekai-linux-arm64.deb: sha256:$(sha256sum ./bin/sekai-linux-arm64.deb | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "sekai-windows-amd64.exe: sha256:$(sha256sum ./bin/sekai-windows-amd64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo "sekai-windows-arm64.exe: sha256:$(sha256sum ./bin/sekai-windows-arm64.exe | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " source-code.tar.gz: sha256:$(sha256sum ./bin/source-code.tar.gz | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " sekai-utils.sh: sha256:$(sha256sum ./bin/sekai-utils.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo " sekai-env.sh: sha256:$(sha256sum ./bin/sekai-env.sh | awk '{ print $1 }')" >> ./bin/RELEASE.md + echo -e "\`\`\`" >> ./bin/RELEASE.md + tar -czvf deb.tar.gz -C ./bin . + - name: Uploading artifacts + uses: actions/upload-artifact@v3.0.0 + with: + name: sekai-bin-deb + path: ./deb.tar.gz release: name: Create Release runs-on: ubuntu-20.04 @@ -117,154 +117,154 @@ jobs: id-token: write pull-requests: write steps: - # Install the cosign tool - # ref.: https://github.com/sigstore/cosign-installer, v3.2.0 - - name: Install cosign - uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 - with: - cosign-release: 'v2.0.0' - - name: Confirm installation! - run: cosign version - - name: Download artifacts - uses: actions/download-artifact@v3.0.0 - with: - name: sekai-bin-deb - - name: Inspecting & organizing artifacts - run: | - echo "(current dir): $PWD" && ls -l ./ - tar xvf ./deb.tar.gz - chmod -Rv 777 ./ - RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') - RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV - echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV - REPOSITORY_NAME="${{ github.event.repository.name }}" - echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV - git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - [[ "$RELEASE_VER" == *"-rc"* ]] && echo "PRE_RELEASE=true" >> $GITHUB_ENV || echo "PRE_RELEASE=false" >> $GITHUB_ENV - # Branch name is also a version of the release - # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions - - name: Extract branch name on push - if: github.event_name == 'push' - shell: bash - run: | - echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - - name: Extract branch name on pull request - if: github.event_name == 'pull_request' - env: - REF_BRANCH: ${{ github.event.pull_request.head.ref }} - BASE_REF_BRANCH: ${{ github.base_ref }} - shell: bash - run: | - echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV - echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV - - name: Print debug data before publishing - run: | - echo " Source branch: ${{ env.SOURCE_BRANCH }}" - echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" - echo "Release branch: ${{ env.RELEASE_BRANCH }}" - echo " Repo Name: ${{ env.REPOSITORY_NAME }}" - echo " Event name: ${{ github.event_name }}" - echo " Release ver.: ${{ env.RELEASE_VER }}" - echo "Release exists: ${{ env.RELEASE_EXISTS }}" - echo " Pre-release: ${{ env.PRE_RELEASE }}" - - name: Reject on error - # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 - uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 - if: ${{ failure() }} - with: - spam_label: "Build Errors" - close_spam_prs: "yes" - access_token: ${{ secrets.GITHUB_TOKEN }} - # ref: https://github.com/softprops/action-gh-release, v0.1.14 - # Release on merge only (push action) - this should run only once - - name: Signing release files - if: | - github.event_name == 'push' && - ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) - shell: bash - env: - KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} - COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} - run: | - echo "$KEY" > ../cosign.key - for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --yes --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done - rm -fv ../cosign.key - # ref: https://github.com/softprops/action-gh-release, v0.1.14 - # Release on merge only (push action) - this should run only once - - name: Publish release - if: | - github.event_name == 'push' && - ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && - ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) - uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 - with: - body_path: RELEASE.md - tag_name: ${{ env.RELEASE_VER }} - name: ${{ env.RELEASE_VER }} - prerelease: ${{ env.PRE_RELEASE }} - draft: false - fail_on_unmatched_files: true - files: | - ./sekai-linux-amd64.deb - ./sekai-linux-amd64.deb.sig - ./sekai-linux-arm64.deb - ./sekai-linux-arm64.deb.sig - ./sekai-darwin-amd64.deb - ./sekai-darwin-amd64.deb.sig - ./sekai-darwin-arm64.deb - ./sekai-darwin-arm64.deb.sig - ./sekai-windows-amd64.exe - ./sekai-windows-amd64.exe.sig - ./sekai-windows-arm64.exe - ./sekai-windows-arm64.exe.sig - ./sekai-utils.sh - ./sekai-utils.sh.sig - ./sekai-env.sh - ./sekai-env.sh.sig - ./source-code.tar.gz - ./source-code.tar.gz.sig - # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 - # Do NOT approve IF release exists and the source branch is NOT a version branch - - name: Approve pull request on success - uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 - if: | - ( github.event_name == 'pull_request' ) && - ( env.SOURCE_BRANCH == env.RELEASE_BRANCH || env.DESTINATION_BRANCH == env.RELEASE_BRANCH ) - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Cleanup all resources - shell: bash - run: | - rm -rfv ./* - echo "(current dir): $PWD" && ls -l ./ - # Work around https://github.com/actions/checkout/issues/760 - - name: Add safe.directory - run: | - git config --global --add safe.directory /github/workspace - git config --global --add safe.directory $PWD - # ref.: https://github.com/actions/checkout, v3.0.0 - - name: Checkout repository - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - - name: Create PR from a version branch to latest - # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead - uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 - if: | - github.event_name == 'push' && - ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) - with: - github_token: ${{ secrets.REPO_ACCESS }} - source_branch: ${{ env.SOURCE_BRANCH }} - destination_branch: 'latest' - pr_title: "${{ env.SOURCE_BRANCH }} -> latest" - pr_label: "kira-automation,automerge" - pr_allow_empty: true - - name: Auto-merge version branch to latest branch - uses: pascalgn/automerge-action@04dfc9eae2586d19b7362d4f6413c48135d9c25a - if: github.event_name == 'pull_request' && env.DESTINATION_BRANCH == 'latest' && - ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) - env: - MERGE_LABELS: "automerge" - GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}" - LOG: "TRACE" + # Install the cosign tool + # ref.: https://github.com/sigstore/cosign-installer, v3.4.0 + - name: Install cosign + uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0 + with: + cosign-release: 'v2.2.3' + - name: Confirm installation! + run: cosign version + - name: Download artifacts + uses: actions/download-artifact@v3.0.0 + with: + name: sekai-bin-deb + - name: Inspecting & organizing artifacts + run: | + echo "(current dir): $PWD" && ls -l ./ + tar xvf ./deb.tar.gz + chmod -Rv 777 ./ + RELEASE_VER=$(cat ./RELEASE.md | tac | grep -Fn -m 1 'Release Versions: ' | rev | cut -d ":" -f1 | rev | xargs | tr -dc '[:alnum:]\-\.' || echo '') + RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV + echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV + REPOSITORY_NAME="${{ github.event.repository.name }}" + echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV + git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + [[ "$RELEASE_VER" == *"-rc"* ]] && echo "PRE_RELEASE=true" >> $GITHUB_ENV || echo "PRE_RELEASE=false" >> $GITHUB_ENV + # Branch name is also a version of the release + # ref: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions + - name: Extract branch name on push + if: github.event_name == 'push' + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + - name: Extract branch name on pull request + if: github.event_name == 'pull_request' + env: + REF_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_REF_BRANCH: ${{ github.base_ref }} + shell: bash + run: | + echo "SOURCE_BRANCH=$(echo ${{ env.REF_BRANCH }})" >> $GITHUB_ENV + echo "DESTINATION_BRANCH=$(echo ${{ env.BASE_REF_BRANCH }})" >> $GITHUB_ENV + - name: Print debug data before publishing + run: | + echo " Source branch: ${{ env.SOURCE_BRANCH }}" + echo " Dest. branch: ${{ env.DESTINATION_BRANCH }}" + echo "Release branch: ${{ env.RELEASE_BRANCH }}" + echo " Repo Name: ${{ env.REPOSITORY_NAME }}" + echo " Event name: ${{ github.event_name }}" + echo " Release ver.: ${{ env.RELEASE_VER }}" + echo "Release exists: ${{ env.RELEASE_EXISTS }}" + echo " Pre-release: ${{ env.PRE_RELEASE }}" + - name: Reject on error + # ref.: https://github.com/andrewslotin/rummelsnuff, v1.1.0 + uses: andrewslotin/rummelsnuff@a0c9c1929f44eefff922aced1ee4dd64eddf12d6 + if: ${{ failure() }} + with: + spam_label: "Build Errors" + close_spam_prs: "yes" + access_token: ${{ secrets.GITHUB_TOKEN }} + # ref: https://github.com/softprops/action-gh-release, v0.1.14 + # Release on merge only (push action) - this should run only once + - name: Signing release files + if: | + github.event_name == 'push' && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) + shell: bash + env: + KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} + run: | + echo "$KEY" > ../cosign.key + for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --yes --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done + rm -fv ../cosign.key + # ref: https://github.com/softprops/action-gh-release, v0.1.14 + # Release on merge only (push action) - this should run only once + - name: Publish release + if: | + github.event_name == 'push' && + ( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) + uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 + with: + body_path: RELEASE.md + tag_name: ${{ env.RELEASE_VER }} + name: ${{ env.RELEASE_VER }} + prerelease: ${{ env.PRE_RELEASE }} + draft: false + fail_on_unmatched_files: true + files: | + ./sekai-linux-amd64.deb + ./sekai-linux-amd64.deb.sig + ./sekai-linux-arm64.deb + ./sekai-linux-arm64.deb.sig + ./sekai-darwin-amd64.deb + ./sekai-darwin-amd64.deb.sig + ./sekai-darwin-arm64.deb + ./sekai-darwin-arm64.deb.sig + ./sekai-windows-amd64.exe + ./sekai-windows-amd64.exe.sig + ./sekai-windows-arm64.exe + ./sekai-windows-arm64.exe.sig + ./sekai-utils.sh + ./sekai-utils.sh.sig + ./sekai-env.sh + ./sekai-env.sh.sig + ./source-code.tar.gz + ./source-code.tar.gz.sig + # ref.: https://github.com/hmarr/auto-approve-action, v2.1.0 + # Do NOT approve IF release exists and the source branch is NOT a version branch + - name: Approve pull request on success + uses: hmarr/auto-approve-action@5d04a5ca6da9aeb8ca9f31a5239b96fc3e003029 + if: | + ( github.event_name == 'pull_request' ) && + ( env.SOURCE_BRANCH == env.RELEASE_BRANCH || env.DESTINATION_BRANCH == env.RELEASE_BRANCH ) + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Cleanup all resources + shell: bash + run: | + rm -rfv ./* + echo "(current dir): $PWD" && ls -l ./ + # Work around https://github.com/actions/checkout/issues/760 + - name: Add safe.directory + run: | + git config --global --add safe.directory /github/workspace + git config --global --add safe.directory $PWD + # ref.: https://github.com/actions/checkout, v3.0.0 + - name: Checkout repository + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 + - name: Create PR from a version branch to latest + # ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead + uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 + if: | + github.event_name == 'push' && + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) + with: + github_token: ${{ secrets.REPO_ACCESS }} + source_branch: ${{ env.SOURCE_BRANCH }} + destination_branch: 'latest' + pr_title: "${{ env.SOURCE_BRANCH }} -> latest" + pr_label: "kira-automation,automerge" + pr_allow_empty: true + - name: Auto-merge version branch to latest branch + uses: pascalgn/automerge-action@04dfc9eae2586d19b7362d4f6413c48135d9c25a + if: github.event_name == 'pull_request' && env.DESTINATION_BRANCH == 'latest' && + ( startsWith(env.SOURCE_BRANCH, 'release/v') && contains(env.SOURCE_BRANCH, '.') ) + env: + MERGE_LABELS: "automerge" + GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}" + LOG: "TRACE" diff --git a/RELEASE.md b/RELEASE.md index 1d15c3e72..ef4078f46 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,8 @@ Features: -- Docs update -- Set execution fees proposal -- Proper error handling for non existing identity records key from an address -- Fix usage of native cosmos staking module msg to custom staking module msg +- Unique identity keys +- Genesis init fix +- CLI to use flags for execution fees proposal +- Slashing module params to gov module properties +- Identity record verification bug fix +- Network properties handling fix diff --git a/app/ante/ante.go b/app/ante/ante.go index 77cb321cf..2f19da9c6 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -6,6 +6,7 @@ import ( "fmt" "time" + errorsmod "cosmossdk.io/errors" kiratypes "github.com/KiraCore/sekai/types" custodykeeper "github.com/KiraCore/sekai/x/custody/keeper" custodytypes "github.com/KiraCore/sekai/x/custody/types" @@ -80,7 +81,7 @@ func NewCustodyDecorator(ck custodykeeper.Keeper, gk customgovkeeper.Keeper) Cus func (cd CustodyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } for _, msg := range feeTx.GetMsgs() { @@ -92,126 +93,126 @@ func (cd CustodyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, { msg, ok := msg.(*custodytypes.MsgCreateCustodyRecord) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeAddToCustodyWhiteList: { msg, ok := msg.(*custodytypes.MsgAddToCustodyWhiteList) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeAddToCustodyCustodians: { msg, ok := msg.(*custodytypes.MsgAddToCustodyCustodians) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeRemoveFromCustodyCustodians: { msg, ok := msg.(*custodytypes.MsgRemoveFromCustodyCustodians) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeDropCustodyCustodians: { msg, ok := msg.(*custodytypes.MsgDropCustodyCustodians) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeRemoveFromCustodyWhiteList: { msg, ok := msg.(*custodytypes.MsgRemoveFromCustodyWhiteList) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeDropCustodyWhiteList: { msg, ok := msg.(*custodytypes.MsgDropCustodyWhiteList) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidType, "Not a MsgCreateCustodyRecord") } hash := sha256.Sum256([]byte(msg.OldKey)) hashString := hex.EncodeToString(hash[:]) if msg.TargetAddress != "" && msg.TargetAddress != settings.NextController { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongTargetAddr, "Custody module") } if hashString != settings.Key { - return ctx, sdkerrors.Wrap(custodytypes.ErrWrongKey, "Custody module") + return ctx, errorsmod.Wrap(custodytypes.ErrWrongKey, "Custody module") } } case kiratypes.MsgTypeSend: @@ -222,15 +223,15 @@ func (cd CustodyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, count := uint64(len(custodians.Addresses)) if len(msg.Reward) < 1 { - return ctx, sdkerrors.Wrap(custodytypes.ErrNotEnoughReward, "no reward") + return ctx, errorsmod.Wrap(custodytypes.ErrNotEnoughReward, "no reward") } if msg.Reward[0].Amount.Uint64() < properties.MinCustodyReward*count { - return ctx, sdkerrors.Wrap(custodytypes.ErrNotEnoughReward, "to small reward") + return ctx, errorsmod.Wrap(custodytypes.ErrNotEnoughReward, "to small reward") } if msg.Reward[0].Denom != cd.ck.DefaultDenom(ctx) { - return ctx, sdkerrors.Wrap(custodytypes.ErrNotEnoughReward, "wrong reward denom") + return ctx, errorsmod.Wrap(custodytypes.ErrNotEnoughReward, "wrong reward denom") } } } @@ -244,7 +245,7 @@ func (cd CustodyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, custodians := cd.ck.GetCustodyCustodiansByAddress(ctx, msg.GetSigners()[0]) if len(custodians.Addresses) > 0 { - return ctx, sdkerrors.Wrap(sdkerrors.ErrConflict, "Custody module is enabled. Please use custody send instead.") + return ctx, errorsmod.Wrap(sdkerrors.ErrConflict, "Custody module is enabled. Please use custody send instead.") } } @@ -316,7 +317,7 @@ func NewValidateFeeRangeDecorator( func (svd ValidateFeeRangeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") } properties := svd.cgk.GetNetworkProperties(ctx) @@ -328,13 +329,13 @@ func (svd ValidateFeeRangeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu for _, feeCoin := range feeCoins { rate := svd.tk.GetTokenRate(ctx, feeCoin.Denom) if !properties.EnableForeignFeePayments && feeCoin.Denom != defaultDenom { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("foreign fee payments is disabled by governance")) + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("foreign fee payments is disabled by governance")) } if rate == nil || !rate.FeePayments { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("currency you are trying to use was not whitelisted as fee payment")) + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("currency you are trying to use was not whitelisted as fee payment")) } if tokensBlackWhite.IsFrozen(feeCoin.Denom, defaultDenom, properties.EnableTokenBlacklist, properties.EnableTokenWhitelist) { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("currency you are trying to use as fee is frozen")) + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("currency you are trying to use as fee is frozen")) } feeAmount = feeAmount.Add(sdk.NewDecFromInt(feeCoin.Amount).Mul(rate.FeeRate)) } @@ -353,11 +354,11 @@ func (svd ValidateFeeRangeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu } if feeAmount.LT(sdk.NewDec(int64(properties.MinTxFee))) || feeAmount.GT(sdk.NewDec(int64(properties.MaxTxFee))) { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("fee %+v(%d) is out of range [%d, %d]%s", feeTx.GetFee(), feeAmount.RoundInt().Int64(), properties.MinTxFee, properties.MaxTxFee, defaultDenom)) + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("fee %+v(%d) is out of range [%d, %d]%s", feeTx.GetFee(), feeAmount.RoundInt().Int64(), properties.MinTxFee, properties.MaxTxFee, defaultDenom)) } if feeAmount.LT(sdk.NewDec(int64(executionMaxFee))) { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("fee %+v(%d) is less than max execution fee %d%s", feeTx.GetFee(), feeAmount.RoundInt().Int64(), executionMaxFee, defaultDenom)) + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("fee %+v(%d) is less than max execution fee %d%s", feeTx.GetFee(), feeAmount.RoundInt().Int64(), executionMaxFee, defaultDenom)) } return next(ctx, tx, simulate) @@ -383,7 +384,7 @@ func NewExecutionFeeRegistrationDecorator(ak keeper.AccountKeeper, cgk customgov func (sgcd ExecutionFeeRegistrationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { sigTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } // execution fee consume gas @@ -426,7 +427,7 @@ func findString(a []string, x string) int { func (pnmd PoorNetworkManagementDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { sigTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } // if not poor network, skip this process @@ -440,10 +441,10 @@ func (pnmd PoorNetworkManagementDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx // on poor network, we introduce POOR_NETWORK_MAX_BANK_TX_SEND network property to limit transaction send amount msg := msg.(*bank.MsgSend) if len(msg.Amount) > 1 || msg.Amount[0].Denom != pnmd.csk.DefaultDenom(ctx) { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only bond denom is allowed on poor network") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "only bond denom is allowed on poor network") } if msg.Amount[0].Amount.Uint64() > pnmd.cgk.GetNetworkProperties(ctx).PoorNetworkMaxBankSend { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "only restricted amount send is allowed on poor network") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "only restricted amount send is allowed on poor network") } // TODO: we could do restriction to send only when target account does not exist on chain yet for more restriction return next(ctx, tx, simulate) @@ -451,7 +452,7 @@ func (pnmd PoorNetworkManagementDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx if findString(pnmsgs.Messages, kiratypes.MsgType(msg)) >= 0 { return next(ctx, tx, simulate) } - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid transaction type on poor network") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid transaction type on poor network") } return next(ctx, tx, simulate) @@ -477,7 +478,7 @@ func NewBlackWhiteTokensCheckDecorator(cgk customgovkeeper.Keeper, csk customsta func (pnmd BlackWhiteTokensCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { sigTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } defaultDenom := pnmd.csk.DefaultDenom(ctx) @@ -488,7 +489,7 @@ func (pnmd BlackWhiteTokensCheckDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx msg := msg.(*bank.MsgSend) for _, amt := range msg.Amount { if tokensBlackWhite.IsFrozen(amt.Denom, defaultDenom, properties.EnableTokenBlacklist, properties.EnableTokenWhitelist) { - return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "token is frozen") + return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "token is frozen") } } } diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index 8d09f927e..22617898b 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -33,11 +33,12 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { Timeout: 0, DefaultParameters: 0, }) - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) // Same data for every test cases accounts := suite.CreateTestAccounts(5) @@ -59,11 +60,7 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { "insufficient max execution fee set", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { msgs := []sdk.Msg{ - govtypes.NewMsgSetNetworkProperties(accounts[0].acc.GetAddress(), &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }), + govtypes.NewMsgSetNetworkProperties(accounts[0].acc.GetAddress(), properties), } return msgs, privs[0:1], accNums[0:1], []uint64{0}, defaultFee }, @@ -75,11 +72,7 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { "execution failure fee deduction", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { msgs := []sdk.Msg{ - govtypes.NewMsgSetNetworkProperties(accounts[1].acc.GetAddress(), &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }), + govtypes.NewMsgSetNetworkProperties(accounts[1].acc.GetAddress(), properties), } return msgs, privs[1:2], accNums[1:2], []uint64{0}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 10000)) }, @@ -147,11 +140,12 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "foreign currency as fee payment when EnableForeignFeePayments is enabled by governance", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) msgs := []sdk.Msg{ govtypes.NewMsgSetExecutionFee( types.MsgTypeSetNetworkProperties, @@ -171,11 +165,12 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "foreign currency as fee payment when EnableForeignFeePayments is disabled by governance", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: false, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = false + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) msgs := []sdk.Msg{ govtypes.NewMsgSetExecutionFee( types.MsgTypeSetNetworkProperties, @@ -195,12 +190,14 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "try sending non bond denom coins on poor network", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - MinValidators: 100, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.MinValidators = 100 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + msgs := []sdk.Msg{ bank.NewMsgSend( accounts[4].acc.GetAddress(), @@ -217,13 +214,15 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "try sending more bond denom than restricted amount on poor network", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - MinValidators: 100, - PoorNetworkMaxBankSend: 1000, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.MinValidators = 100 + properties.PoorNetworkMaxBankSend = 1000 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + msgs := []sdk.Msg{ bank.NewMsgSend( accounts[4].acc.GetAddress(), @@ -240,13 +239,15 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "try sending lower than restriction amount on poor network", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - MinValidators: 100, - PoorNetworkMaxBankSend: 1000, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.MinValidators = 100 + properties.PoorNetworkMaxBankSend = 1000 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + msgs := []sdk.Msg{ bank.NewMsgSend( accounts[4].acc.GetAddress(), @@ -263,12 +264,14 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "try sending enabled message on poor network", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - MinValidators: 100, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.MinValidators = 100 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + msgs := []sdk.Msg{ govtypes.NewMsgSetNetworkProperties( accounts[4].acc.GetAddress(), @@ -289,12 +292,14 @@ func (suite *AnteTestSuite) TestCustomAnteHandlerExecutionFee() { { "try sending not enabled message on poor network", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - MinValidators: 100, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.MinValidators = 100 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + msgs := []sdk.Msg{ govtypes.NewMsgSetExecutionFee( types.MsgTypeSetNetworkProperties, @@ -348,14 +353,14 @@ func (suite *AnteTestSuite) TestValidateFeeRangeDecorator() { // Same data for every test cases accounts := suite.CreateTestAccounts(5) - suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("ukex", 10000)) - suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("frozen", 10000)) - suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("nofeetoken", 10000)) - suite.SetBalance(accounts[1].acc.GetAddress(), sdk.NewInt64Coin("ukex", 10000)) - suite.SetBalance(accounts[2].acc.GetAddress(), sdk.NewInt64Coin("ukex", 10000)) + suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("ukex", 100000)) + suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("frozen", 100000)) + suite.SetBalance(accounts[0].acc.GetAddress(), sdk.NewInt64Coin("nofeetoken", 100000)) + suite.SetBalance(accounts[1].acc.GetAddress(), sdk.NewInt64Coin("ukex", 100000)) + suite.SetBalance(accounts[2].acc.GetAddress(), sdk.NewInt64Coin("ukex", 100000)) suite.SetBalance(accounts[3].acc.GetAddress(), sdk.NewInt64Coin("ukex", 1)) - suite.SetBalance(accounts[4].acc.GetAddress(), sdk.NewInt64Coin("ukex", 10000)) - suite.SetBalance(accounts[4].acc.GetAddress(), sdk.NewInt64Coin("ubtc", 10000)) + suite.SetBalance(accounts[4].acc.GetAddress(), sdk.NewInt64Coin("ukex", 100000)) + suite.SetBalance(accounts[4].acc.GetAddress(), sdk.NewInt64Coin("ubtc", 100000)) gasLimit := testdata.NewTestGasLimit() privs := []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv, accounts[2].priv, accounts[3].priv, accounts[4].priv} accNums := []uint64{0, 1, 2, 3, 4} @@ -414,14 +419,14 @@ func (suite *AnteTestSuite) TestValidateFeeRangeDecorator() { { "fee out of range for low amount", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - err := suite.app.CustomGovKeeper.SetNetworkProperty(suite.ctx, govtypes.EnableForeignFeePayments, govtypes.NetworkPropertyValue{Value: 0}) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = false + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) suite.Require().NoError(err) msgs := []sdk.Msg{ - govtypes.NewMsgSetNetworkProperties(accounts[4].acc.GetAddress(), &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }), + govtypes.NewMsgSetNetworkProperties(accounts[4].acc.GetAddress(), properties), } return msgs, privs[0:1], accNums[0:1], []uint64{0}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 1)) }, @@ -432,14 +437,14 @@ func (suite *AnteTestSuite) TestValidateFeeRangeDecorator() { { "fee out of range for big amount", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - err := suite.app.CustomGovKeeper.SetNetworkProperty(suite.ctx, govtypes.EnableForeignFeePayments, govtypes.NetworkPropertyValue{Value: 0}) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = false + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) suite.Require().NoError(err) msgs := []sdk.Msg{ - govtypes.NewMsgSetNetworkProperties(accounts[4].acc.GetAddress(), &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - }), + govtypes.NewMsgSetNetworkProperties(accounts[4].acc.GetAddress(), properties), } return msgs, privs[0:1], accNums[0:1], []uint64{0}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 10001)) }, @@ -450,7 +455,11 @@ func (suite *AnteTestSuite) TestValidateFeeRangeDecorator() { { "fee should be bigger than max of execution and failure fee", func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) { - err := suite.app.CustomGovKeeper.SetNetworkProperty(suite.ctx, govtypes.EnableForeignFeePayments, govtypes.NetworkPropertyValue{Value: 0}) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = false + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) suite.Require().NoError(err) msgs := []sdk.Msg{ govtypes.NewMsgSetNetworkProperties(accounts[4].acc.GetAddress(), &govtypes.NetworkProperties{ @@ -482,17 +491,18 @@ func (suite *AnteTestSuite) TestValidateFeeRangeDecorator() { func (suite *AnteTestSuite) TestPoorNetworkManagementDecorator() { suite.SetupTest(false) // reset - // set execution fee for set network properties - suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, &govtypes.NetworkProperties{ - MinTxFee: 2, - MaxTxFee: 10000, - EnableForeignFeePayments: true, - EnableTokenBlacklist: true, - EnableTokenWhitelist: false, - MinValidators: 10, - PoorNetworkMaxBankSend: 1000, - }) + properties := suite.app.CustomGovKeeper.GetNetworkProperties(suite.ctx) + properties.MinTxFee = 2 + properties.MaxTxFee = 10000 + properties.EnableForeignFeePayments = true + properties.EnableTokenBlacklist = true + properties.EnableTokenWhitelist = false + properties.MinValidators = 10 + properties.PoorNetworkMaxBankSend = 1000 + err := suite.app.CustomGovKeeper.SetNetworkProperties(suite.ctx, properties) + suite.Require().NoError(err) + // set execution fee for set network properties suite.app.CustomGovKeeper.SetExecutionFee(suite.ctx, govtypes.ExecutionFee{ TransactionType: types.MsgTypeSetNetworkProperties, ExecutionFee: 10000, @@ -535,7 +545,7 @@ func (suite *AnteTestSuite) TestPoorNetworkManagementDecorator() { msgs := []sdk.Msg{ bank.NewMsgSend(accounts[4].acc.GetAddress(), accounts[3].acc.GetAddress(), sdk.Coins{sdk.NewInt64Coin("ukex", 2000)}), } - return msgs, privs[0:1], accNums[0:1], []uint64{0}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100)) + return msgs, privs[0:1], accNums[0:1], []uint64{1}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100)) }, true, false, @@ -556,7 +566,7 @@ func (suite *AnteTestSuite) TestPoorNetworkManagementDecorator() { false, ), } - return msgs, privs[0:1], accNums[0:1], []uint64{0}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100)) + return msgs, privs[0:1], accNums[0:1], []uint64{1}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100)) }, true, false, diff --git a/app/app.go b/app/app.go index 793b769a0..87a12d3b4 100644 --- a/app/app.go +++ b/app/app.go @@ -278,7 +278,6 @@ func NewInitApp( &customStakingKeeper, multiStakingKeeper, app.CustomGovKeeper, - app.GetSubspace(slashingtypes.ModuleName), ) app.BasketKeeper = basketkeeper.NewKeeper( diff --git a/app/posthandler/exec.go b/app/posthandler/exec.go index d52256aa0..c0ac38185 100644 --- a/app/posthandler/exec.go +++ b/app/posthandler/exec.go @@ -1,6 +1,7 @@ package posthandler import ( + errorsmod "cosmossdk.io/errors" kiratypes "github.com/KiraCore/sekai/types" feeprocessingkeeper "github.com/KiraCore/sekai/x/feeprocessing/keeper" customgovkeeper "github.com/KiraCore/sekai/x/gov/keeper" @@ -27,7 +28,7 @@ func NewExecutionDecorator( func (d ExecutionDecorator) PostHandle(ctx sdk.Context, tx sdk.Tx, simulate, success bool, next sdk.PostHandler) (sdk.Context, error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { - return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") + return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") } // execution fee should be prepaid diff --git a/proto/kira/collectives/collective.proto b/proto/kira/collectives/collective.proto index c024721a5..5c26fbe74 100644 --- a/proto/kira/collectives/collective.proto +++ b/proto/kira/collectives/collective.proto @@ -58,7 +58,10 @@ message Collective { uint64 claim_start = 7; // (optional) timestamp defining when rewards claiming should start uint64 claim_period = 8; // (optional) period in seconds defining every what period of time reward claim should be triggered uint64 claim_end = 9; // (optional) timestamp defining when rewards claiming should end - uint64 vote_quorum = 10; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid + string vote_quorum = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid uint64 vote_period = 11; // seconds - default: 600s, period of time in seconds that any of the collective proposals must last before passing or being rejected uint64 vote_enactment = 12; // seconds - default: 300s, period of time that must pass before any of the collective proposals is enacted repeated string donations = 13 [ diff --git a/proto/kira/collectives/proposal.proto b/proto/kira/collectives/proposal.proto index 2ed224476..7fb9c561f 100644 --- a/proto/kira/collectives/proposal.proto +++ b/proto/kira/collectives/proposal.proto @@ -35,7 +35,10 @@ message ProposalCollectiveUpdate { uint64 claim_start = 7; // (optional) timestamp defining when rewards claiming should start uint64 claim_period = 8; // (optional) period in seconds defining every what period of time reward claim should be triggered uint64 claim_end = 9; // (optional) timestamp defining when rewards claiming should end - uint64 vote_quorum = 10; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid + string vote_quorum = 10 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid uint64 vote_period = 11; // seconds - default: 600s, period of time in seconds that any of the collective proposals must last before passing or being rejected uint64 vote_enactment = 12; // seconds - default: 300s, period of time that must pass before any of the collective proposals is enacted } diff --git a/proto/kira/collectives/tx.proto b/proto/kira/collectives/tx.proto index fe3476e05..d2cf99d5e 100644 --- a/proto/kira/collectives/tx.proto +++ b/proto/kira/collectives/tx.proto @@ -45,7 +45,10 @@ message MsgCreateCollective { uint64 claim_start = 8; // (optional) timestamp defining when rewards claiming should start uint64 claim_period = 9; // (optional) period in seconds defining every what period of time reward claim should be triggered uint64 claim_end = 10; // (optional) timestamp defining when rewards claiming should end - uint64 vote_quorum = 11; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid + string vote_quorum = 11 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid uint64 vote_period = 12; // seconds - default: 600s, period of time in seconds that any of the collective proposals must last before passing or being rejected uint64 vote_enactment = 13; // seconds - default: 300s, period of time that must pass before any of the collective proposals is enacted } diff --git a/proto/kira/gov/network_properties.proto b/proto/kira/gov/network_properties.proto index 9b8e8b0ed..53ba86aa7 100644 --- a/proto/kira/gov/network_properties.proto +++ b/proto/kira/gov/network_properties.proto @@ -76,6 +76,7 @@ enum NetworkProperty { MINTING_NFT_FEE = 58 [ (gogoproto.enumvalue_customname) = "MintingNftFee" ]; VETO_THRESHOLD = 59 [ (gogoproto.enumvalue_customname) = "VetoThreshold" ]; AUTOCOMPOUND_INTERVAL_NUM_BLOCKS = 60 [ (gogoproto.enumvalue_customname) = "AutocompoundIntervalNumBlocks" ]; + DOWNTIME_INACTIVE_DURATION = 61 [ (gogoproto.enumvalue_customname) = "DowntimeInactiveDuration" ]; } message NetworkPropertyValue { @@ -88,7 +89,10 @@ message NetworkPropertyValue { message NetworkProperties { uint64 min_tx_fee = 1; // minimum transaction fee uint64 max_tx_fee = 2; // maximum transaction fee - uint64 vote_quorum = 3; // vote quorum to reach to move to enactment + string vote_quorum = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // vote quorum to reach to move to enactment uint64 minimum_proposal_end_time = 4; // the minimum duration to start processing the proposal uint64 proposal_enactment_time = 5; // the duration to wait for enactment after proposal processing uint64 min_proposal_end_blocks = 6; // minimum blocks required for proposal voting @@ -162,7 +166,10 @@ message NetworkProperties { uint64 dapp_auto_denounce_time = 53; // in seconds (default 60), time the dapp leader allowed to send `execute-dapp-tx` uint64 dapp_mischance_rank_decrease_amount = 54; uint64 dapp_max_mischance = 55; - uint64 dapp_inactive_rank_decrease_percent = 56; + string dapp_inactive_rank_decrease_percent = 56 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; string dapp_pool_slippage_default = 57 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false @@ -174,4 +181,5 @@ message NetworkProperties { (gogoproto.nullable) = false ]; uint64 autocompound_interval_num_blocks = 61; // default 17280 - once per day + uint64 downtime_inactive_duration = 62; // default 600s - 10min } diff --git a/proto/kira/layer2/layer2.proto b/proto/kira/layer2/layer2.proto index 78155d0e0..24d96bf49 100644 --- a/proto/kira/layer2/layer2.proto +++ b/proto/kira/layer2/layer2.proto @@ -79,7 +79,10 @@ message Dapp { ]; // total bonds put on the dapp uint64 creation_time = 17; // dapp creation time DappStatus status = 18; // dapp status - uint64 vote_quorum = 19; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid + string vote_quorum = 19 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage - default: 51%, collective-specific % of owner accounts that must vote YES or NO for any of the collective proposals to be valid uint64 vote_period = 20; // seconds - default: 600s, period of time in seconds that any of the collective proposals must last before passing or being rejected uint64 vote_enactment = 21; // seconds - default: 300s, period of time that must pass before any of the collective proposals is enacted uint64 liquidation_start = 22; // liquidation start time diff --git a/proto/kira/slashing/v1beta1/genesis.proto b/proto/kira/slashing/v1beta1/genesis.proto index 2cbd933a3..5fd1b0d91 100644 --- a/proto/kira/slashing/v1beta1/genesis.proto +++ b/proto/kira/slashing/v1beta1/genesis.proto @@ -8,12 +8,9 @@ import "kira/slashing/v1beta1/slashing.proto"; // GenesisState defines the slashing module's genesis state. message GenesisState { - // params defines all the paramaters of related to deposit. - Params params = 1 [(gogoproto.nullable) = false]; - // signing_infos represents a map between validator addresses and their // signing infos. - repeated SigningInfo signing_infos = 2 + repeated SigningInfo signing_infos = 1 [(gogoproto.moretags) = "yaml:\"signing_infos\"", (gogoproto.nullable) = false]; } diff --git a/proto/kira/slashing/v1beta1/query.proto b/proto/kira/slashing/v1beta1/query.proto index 92cf0b2f0..6a9f54fa9 100644 --- a/proto/kira/slashing/v1beta1/query.proto +++ b/proto/kira/slashing/v1beta1/query.proto @@ -14,11 +14,6 @@ option go_package = "github.com/KiraCore/sekai/x/slashing/types"; // Query provides defines the gRPC querier service service Query { - // Params queries the parameters of slashing module - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/kira/slashing/v1beta1/params"; - } - // SigningInfo queries the signing info of given cons address rpc SigningInfo(QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { option (google.api.http).get = "/kira/slashing/v1beta1/signing_infos/{cons_address}"; diff --git a/proto/kira/spending/pool.proto b/proto/kira/spending/pool.proto index 983894159..6e425e7de 100644 --- a/proto/kira/spending/pool.proto +++ b/proto/kira/spending/pool.proto @@ -57,7 +57,10 @@ message SpendingPool { (gogoproto.nullable) = false ]; // pool specific % of owner accounts that must vote YES or NO for any of the pool proposals to be valid. - uint64 vote_quorum = 6; // percentage, # default: 51% + string vote_quorum = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage, # default: 51% // period of time in seconds that any of the pool proposals must last before passing or being rejected uint64 vote_period = 7; // seconds, # default: 600s // period of time that must pass before any of the pool proposal is enacted diff --git a/proto/kira/spending/proposal.proto b/proto/kira/spending/proposal.proto index 4ac402b63..b27caf3fc 100644 --- a/proto/kira/spending/proposal.proto +++ b/proto/kira/spending/proposal.proto @@ -24,7 +24,10 @@ message UpdateSpendingPoolProposal { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.DecCoin", (gogoproto.nullable) = false ]; - uint64 vote_quorum = 5; // percentage, # default: 51% + string vote_quorum = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage, # default: 51% uint64 vote_period = 6; // seconds, # default: 600s uint64 vote_enactment = 7; // seconds, # default: 300s kira.spending.PermInfo owners = 8 [ (gogoproto.nullable) = false ]; diff --git a/proto/kira/spending/tx.proto b/proto/kira/spending/tx.proto index 95d68a71e..668afb4da 100644 --- a/proto/kira/spending/tx.proto +++ b/proto/kira/spending/tx.proto @@ -40,7 +40,10 @@ message MsgCreateSpendingPool { (gogoproto.nullable) = false ]; // pool specific % of owner accounts that must vote YES or NO for any of the pool proposals to be valid. - uint64 vote_quorum = 6; // percentage, # default: 51% + string vote_quorum = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // percentage, # default: 51% // period of time in seconds that any of the pool proposals must last before passing or being rejected uint64 vote_period = 7; // seconds, # default: 600s // period of time that must pass before any of the pool proposal is enacted diff --git a/types/constants.go b/types/constants.go index 4703e0db5..d8a2bbebc 100644 --- a/types/constants.go +++ b/types/constants.go @@ -3,6 +3,6 @@ package types const ( // we set page iteration limit for safety PageIterationLimit = 512 - SekaiVersion = "v0.3.43" + SekaiVersion = "v0.3.44" CosmosVersion = "v0.47.6" ) diff --git a/x/basket/keeper/basket.go b/x/basket/keeper/basket.go index bcd74b064..6e6cedb1a 100644 --- a/x/basket/keeper/basket.go +++ b/x/basket/keeper/basket.go @@ -1,9 +1,9 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/basket/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k Keeper) GetLastBasketId(ctx sdk.Context) uint64 { @@ -25,7 +25,7 @@ func (k Keeper) GetBasketById(ctx sdk.Context, id uint64) (types.Basket, error) store := ctx.KVStore(k.storeKey) bz := store.Get(append(types.PrefixBasketKey, sdk.Uint64ToBigEndian(id)...)) if bz == nil { - return types.Basket{}, sdkerrors.Wrapf(types.ErrBasketDoesNotExist, "basket: %d does not exist", id) + return types.Basket{}, errorsmod.Wrapf(types.ErrBasketDoesNotExist, "basket: %d does not exist", id) } basket := types.Basket{} k.cdc.MustUnmarshal(bz, &basket) @@ -36,7 +36,7 @@ func (k Keeper) GetBasketByDenom(ctx sdk.Context, denom string) (types.Basket, e store := ctx.KVStore(k.storeKey) bz := store.Get(append(types.PrefixBasketByDenomKey, denom...)) if bz == nil { - return types.Basket{}, sdkerrors.Wrapf(types.ErrBasketDoesNotExist, "basket: %s does not exist", denom) + return types.Basket{}, errorsmod.Wrapf(types.ErrBasketDoesNotExist, "basket: %s does not exist", denom) } id := sdk.BigEndianToUint64(bz) return k.GetBasketById(ctx, id) diff --git a/x/basket/keeper/mint_burn_swap.go b/x/basket/keeper/mint_burn_swap.go index a3042a07a..c0fd30c7b 100644 --- a/x/basket/keeper/mint_burn_swap.go +++ b/x/basket/keeper/mint_burn_swap.go @@ -3,9 +3,9 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/basket/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k Keeper) MintBasketToken(ctx sdk.Context, msg *types.MsgBasketTokenMint) error { @@ -41,7 +41,7 @@ func (k Keeper) MintBasketToken(ctx sdk.Context, msg *types.MsgBasketTokenMint) _, indexes := basket.RatesAndIndexes() tokenIndex := indexes[token.Denom] if !basket.Tokens[tokenIndex].Deposits { - return sdkerrors.Wrap(types.ErrDepositsDisabledForToken, fmt.Sprintf("denom=%s", token.Denom)) + return errorsmod.Wrap(types.ErrDepositsDisabledForToken, fmt.Sprintf("denom=%s", token.Denom)) } basketTokenAmount = basketTokenAmount.Add(sdk.NewDecFromInt(token.Amount).Mul(rate)) } diff --git a/x/basket/keeper/msg_server.go b/x/basket/keeper/msg_server.go index 608ab711b..417ea0f04 100644 --- a/x/basket/keeper/msg_server.go +++ b/x/basket/keeper/msg_server.go @@ -3,10 +3,10 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/basket/types" govtypes "github.com/KiraCore/sekai/x/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) type msgServer struct { @@ -38,7 +38,7 @@ func (k msgServer) DisableBasketDeposits( sender, err := sdk.AccAddressFromBech32(msg.Sender) isAllowed := k.keeper.CheckIfAllowedPermission(ctx, sender, govtypes.PermHandleBasketEmergency) if !isAllowed { - return nil, sdkerrors.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") + return nil, errorsmod.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") } basket.MintsDisabled = true @@ -59,7 +59,7 @@ func (k msgServer) DisableBasketWithdraws( sender, err := sdk.AccAddressFromBech32(msg.Sender) isAllowed := k.keeper.CheckIfAllowedPermission(ctx, sender, govtypes.PermHandleBasketEmergency) if !isAllowed { - return nil, sdkerrors.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") + return nil, errorsmod.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") } basket.BurnsDisabled = true @@ -80,7 +80,7 @@ func (k msgServer) DisableBasketSwaps( sender, err := sdk.AccAddressFromBech32(msg.Sender) isAllowed := k.keeper.CheckIfAllowedPermission(ctx, sender, govtypes.PermHandleBasketEmergency) if !isAllowed { - return nil, sdkerrors.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") + return nil, errorsmod.Wrap(govtypes.ErrNotEnoughPermissions, "PermHandleBasketEmergency") } basket.SwapsDisabled = true diff --git a/x/basket/types/basket.go b/x/basket/types/basket.go index d4e13a8c6..ec9918faa 100644 --- a/x/basket/types/basket.go +++ b/x/basket/types/basket.go @@ -5,8 +5,8 @@ import ( "strconv" "strings" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (b Basket) GetBasketDenom() string { @@ -92,7 +92,7 @@ func (b Basket) ValidateTokensCap() error { for _, token := range b.Tokens { if sdk.NewDecFromInt(token.Amount).Mul(token.Weight).GT(totalTokens.Mul(b.TokensCap)) { - return sdkerrors.Wrap(ErrTokenExceedingCap, fmt.Sprintf("denom=%s", token.Denom)) + return errorsmod.Wrap(ErrTokenExceedingCap, fmt.Sprintf("denom=%s", token.Denom)) } } return nil diff --git a/x/collectives/client/cli/tx.go b/x/collectives/client/cli/tx.go index 1570a12fc..159391e18 100644 --- a/x/collectives/client/cli/tx.go +++ b/x/collectives/client/cli/tx.go @@ -178,7 +178,7 @@ func GetTxCreateCollectiveCmd() *cobra.Command { ownerWhitelist, weightedSpendingPools, claimStart, claimPeriod, claimEnd, - voteQuorum, votePeriod, voteEnactment, + sdk.NewDecWithPrec(int64(voteQuorum), 2), votePeriod, voteEnactment, ) err = msg.ValidateBasic() @@ -589,7 +589,7 @@ func GetTxProposalCollectiveUpdateCmd() *cobra.Command { ownerWhitelist, weightedSpendingPools, claimStart, claimPeriod, claimEnd, - voteQuorum, votePeriod, voteEnactment, + sdk.NewDecWithPrec(int64(voteQuorum), 2), votePeriod, voteEnactment, ), ) if err != nil { diff --git a/x/collectives/keeper/abci_test.go b/x/collectives/keeper/abci_test.go index 5e7b38450..e5f9046b7 100644 --- a/x/collectives/keeper/abci_test.go +++ b/x/collectives/keeper/abci_test.go @@ -75,7 +75,8 @@ func (suite *KeeperTestSuite) TestDistributeCollectiveRewards() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), + 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) @@ -165,7 +166,8 @@ func (suite *KeeperTestSuite) TestEndBlocker() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), + 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) diff --git a/x/collectives/keeper/collective_test.go b/x/collectives/keeper/collective_test.go index 3f0c4b1ba..2447e4f31 100644 --- a/x/collectives/keeper/collective_test.go +++ b/x/collectives/keeper/collective_test.go @@ -28,7 +28,7 @@ func (suite *KeeperTestSuite) TestCollectiveSetGetDelete() { ClaimStart: 0, ClaimPeriod: 1000, ClaimEnd: 100000, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, Donations: []sdk.Coin{sdk.NewInt64Coin("ukex", 1000_000)}, @@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) TestCollectiveSetGetDelete() { ClaimStart: 0, ClaimPeriod: 1000, ClaimEnd: 100000, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, Donations: []sdk.Coin{sdk.NewInt64Coin("ukex", 1000_000)}, @@ -160,7 +160,7 @@ func (suite *KeeperTestSuite) TestSendDonation() { ClaimStart: 0, ClaimPeriod: 1000, ClaimEnd: 100000, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, Donations: []sdk.Coin{sdk.NewInt64Coin("ukex", 100_000)}, @@ -228,7 +228,7 @@ func (suite *KeeperTestSuite) WithdrawCollective() { ClaimStart: 0, ClaimPeriod: 1000, ClaimEnd: 100000, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, Donations: []sdk.Coin{sdk.NewInt64Coin("ukex", 100_000)}, @@ -296,7 +296,7 @@ func (suite *KeeperTestSuite) ExecuteCollectiveRemove() { ClaimStart: 0, ClaimPeriod: 1000, ClaimEnd: 100000, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, Donations: []sdk.Coin{sdk.NewInt64Coin("ukex", 100_000)}, diff --git a/x/collectives/keeper/msg_server_test.go b/x/collectives/keeper/msg_server_test.go index bf6fd9415..6000a9acf 100644 --- a/x/collectives/keeper/msg_server_test.go +++ b/x/collectives/keeper/msg_server_test.go @@ -72,7 +72,7 @@ func (suite *KeeperTestSuite) TestCreateCollective() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) @@ -142,7 +142,7 @@ func (suite *KeeperTestSuite) TestContributeCollective() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) @@ -219,7 +219,7 @@ func (suite *KeeperTestSuite) TestDonateCollective() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) @@ -317,7 +317,7 @@ func (suite *KeeperTestSuite) TestWithdrawCollective() { }, }, 0, 86400, 1000000, - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), 86400, 3000, ) _, err = msgServer.CreateCollective(sdk.WrapSDKContext(suite.ctx), msg) diff --git a/x/collectives/proposal_handler.go b/x/collectives/proposal_handler.go index 1c2fafcec..4027d5de1 100644 --- a/x/collectives/proposal_handler.go +++ b/x/collectives/proposal_handler.go @@ -44,12 +44,12 @@ func (a ApplyCollectiveSendDonationProposalHandler) AllowedAddresses(ctx sdk.Con return a.keeper.AllowedAddresses(ctx, collective.OwnersWhitelist) } -func (a ApplyCollectiveSendDonationProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyCollectiveSendDonationProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.ProposalCollectiveSendDonation) collective := a.keeper.GetCollective(ctx, p.Name) if collective.Name == "" { - return 0 + return sdk.ZeroDec() } return collective.VoteQuorum @@ -123,12 +123,12 @@ func (a ApplyCollectiveUpdateProposalHandler) AllowedAddresses(ctx sdk.Context, return a.keeper.AllowedAddresses(ctx, collective.OwnersWhitelist) } -func (a ApplyCollectiveUpdateProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyCollectiveUpdateProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.ProposalCollectiveUpdate) collective := a.keeper.GetCollective(ctx, p.Name) if collective.Name == "" { - return 0 + return sdk.ZeroDec() } return collective.VoteQuorum @@ -216,12 +216,12 @@ func (a ApplyCollectiveRemoveProposalHandler) AllowedAddresses(ctx sdk.Context, return a.keeper.AllowedAddresses(ctx, collective.OwnersWhitelist) } -func (a ApplyCollectiveRemoveProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyCollectiveRemoveProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.ProposalCollectiveRemove) collective := a.keeper.GetCollective(ctx, p.Name) if collective.Name == "" { - return 0 + return sdk.ZeroDec() } return collective.VoteQuorum diff --git a/x/collectives/types/collective.pb.go b/x/collectives/types/collective.pb.go index e97c55516..c81595473 100644 --- a/x/collectives/types/collective.pb.go +++ b/x/collectives/types/collective.pb.go @@ -225,7 +225,7 @@ type Collective struct { ClaimStart uint64 `protobuf:"varint,7,opt,name=claim_start,json=claimStart,proto3" json:"claim_start,omitempty"` ClaimPeriod uint64 `protobuf:"varint,8,opt,name=claim_period,json=claimPeriod,proto3" json:"claim_period,omitempty"` ClaimEnd uint64 `protobuf:"varint,9,opt,name=claim_end,json=claimEnd,proto3" json:"claim_end,omitempty"` - VoteQuorum uint64 `protobuf:"varint,10,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` VotePeriod uint64 `protobuf:"varint,11,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` VoteEnactment uint64 `protobuf:"varint,12,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` Donations []github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,13,rep,name=donations,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"donations"` @@ -331,13 +331,6 @@ func (m *Collective) GetClaimEnd() uint64 { return 0 } -func (m *Collective) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *Collective) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -448,60 +441,61 @@ func init() { func init() { proto.RegisterFile("kira/collectives/collective.proto", fileDescriptor_a034e57fe22de5f1) } var fileDescriptor_a034e57fe22de5f1 = []byte{ - // 848 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6f, 0x23, 0x35, - 0x14, 0xce, 0x24, 0x69, 0x7e, 0xbc, 0xf4, 0xc7, 0xd4, 0x2a, 0xc8, 0x04, 0x29, 0x99, 0x16, 0x58, - 0x22, 0xd0, 0x26, 0xd2, 0x72, 0xdb, 0x5b, 0x9b, 0x06, 0x14, 0x7e, 0x96, 0xc9, 0x2e, 0x2b, 0x21, - 0xa4, 0xc8, 0x99, 0x31, 0xa9, 0x95, 0x19, 0x3b, 0xd8, 0xce, 0x76, 0x7b, 0x84, 0x13, 0xda, 0x13, - 0x37, 0x4e, 0x2b, 0x21, 0xf1, 0xcf, 0xec, 0x71, 0x8f, 0x88, 0xc3, 0x0a, 0xb5, 0x17, 0xfe, 0x0c, - 0x64, 0xcf, 0x4c, 0x32, 0xcc, 0x16, 0x09, 0xca, 0x69, 0xec, 0xcf, 0xdf, 0xfb, 0x9e, 0xed, 0xef, - 0x3d, 0x0f, 0x1c, 0x2e, 0x98, 0x24, 0x83, 0x40, 0x44, 0x11, 0x0d, 0x34, 0x7b, 0x4c, 0x55, 0x6e, - 0xdc, 0x5f, 0x4a, 0xa1, 0x05, 0x72, 0x0d, 0xa5, 0x9f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 0xff, 0xda, 0x39, 0x86, - 0x7a, 0x24, 0x82, 0x05, 0xe3, 0x73, 0xdb, 0x87, 0x55, 0x3f, 0x9b, 0xa2, 0x8f, 0xa1, 0x91, 0xf9, - 0x63, 0x9b, 0xe9, 0xbf, 0x3f, 0x3e, 0xeb, 0x78, 0x73, 0x3f, 0xd9, 0x78, 0x6a, 0xf4, 0x71, 0xcd, - 0xbe, 0xc8, 0xdb, 0x19, 0xf8, 0xa9, 0x08, 0x16, 0xef, 0xfd, 0xe0, 0x80, 0x5b, 0x7c, 0x39, 0x90, - 0x07, 0xb5, 0xe3, 0xe1, 0x83, 0xf1, 0x57, 0x23, 0xb7, 0xd4, 0x3e, 0x78, 0xfa, 0xcc, 0xcb, 0x31, - 0x8e, 0x93, 0x57, 0xec, 0x6d, 0x68, 0x8c, 0x3f, 0x4f, 0x39, 0x4e, 0xfb, 0xf5, 0xa7, 0xcf, 0x3c, - 0xb4, 0xe1, 0x8c, 0x4d, 0xc1, 0x1a, 0x96, 0x07, 0xb5, 0xb3, 0xe3, 0x87, 0x93, 0xd1, 0xa9, 0x5b, - 0x2e, 0xea, 0x9c, 0x91, 0x95, 0xa2, 0x61, 0xbb, 0xfa, 0xe3, 0xaf, 0x9d, 0xd2, 0xc9, 0x47, 0xcf, - 0xaf, 0x3a, 0xce, 0x8b, 0xab, 0x8e, 0xf3, 0xc7, 0x55, 0xc7, 0xf9, 0xe9, 0xba, 0x53, 0x7a, 0x71, - 0xdd, 0x29, 0xfd, 0x76, 0xdd, 0x29, 0x7d, 0x7d, 0x37, 0x77, 0xea, 0x4f, 0x98, 0x24, 0x43, 0x21, - 0xe9, 0x40, 0xd1, 0x05, 0x61, 0x83, 0x27, 0x7f, 0xfb, 0x31, 0xda, 0x0b, 0x98, 0xd5, 0xec, 0x5f, - 0xe9, 0x83, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, 0x7d, 0x11, 0xc7, 0x39, 0x07, 0x00, 0x00, + // 857 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0x23, 0x35, + 0x18, 0xce, 0x24, 0x69, 0x3e, 0xde, 0xf4, 0x63, 0x6a, 0x15, 0x64, 0x82, 0x94, 0x4c, 0x0b, 0x2c, + 0x11, 0x68, 0x13, 0x69, 0xb9, 0xed, 0xad, 0x4d, 0x03, 0x0a, 0x5f, 0x5b, 0x26, 0xbb, 0xac, 0x84, + 0x90, 0x22, 0x67, 0xc6, 0xa4, 0x56, 0x66, 0xec, 0x60, 0x3b, 0xdb, 0xed, 0x95, 0x13, 0xda, 0x13, + 0x37, 0x4e, 0x2b, 0x21, 0xf1, 0x0b, 0xf8, 0x17, 0x7b, 0xdc, 0x23, 0xe2, 0xb0, 0x42, 0xed, 0x85, + 0x9f, 0x81, 0xec, 0x99, 0x49, 0x86, 0x34, 0x48, 0xd0, 0x3d, 0x8d, 0xfd, 0xf8, 0x79, 0x9f, 0xf7, + 0xb5, 0x1f, 0xbf, 0x1e, 0x38, 0x9c, 0x31, 0x49, 0x7a, 0x81, 0x88, 0x22, 0x1a, 0x68, 0xf6, 0x84, + 0xaa, 0xdc, 0xb8, 0x3b, 0x97, 0x42, 0x0b, 0xe4, 0x1a, 0x4a, 0x37, 0x47, 0x69, 0x1e, 0x4c, 0xc5, + 0x54, 0xd8, 0xc5, 0x9e, 0x19, 0x25, 0xbc, 0xe6, 0x5b, 0x53, 0x21, 0xa6, 0x11, 0xed, 0xd9, 0xd9, + 0x64, 0xf1, 0x5d, 0x8f, 0xf0, 0xcb, 0x6c, 0x29, 0x10, 0x2a, 0x16, 0x6a, 0x9c, 0xc4, 0x24, 0x93, + 0x74, 0xa9, 0xbd, 0x1e, 0xa5, 0x59, 0x4c, 0x95, 0x26, 0xf1, 0x3c, 0x21, 0x1c, 0x7d, 0x0b, 0xee, + 0x29, 0x9d, 0x0b, 0xc5, 0xf4, 0xe3, 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, 0x39, 0xee, 0x3f, 0x1c, 0x7e, 0x3d, + 0x70, 0x0b, 0xcd, 0x83, 0x67, 0xcf, 0xbd, 0x1c, 0xe3, 0x38, 0x79, 0xf5, 0xde, 0x85, 0xda, 0xf0, + 0xcb, 0x94, 0xe3, 0x34, 0xdf, 0x7c, 0xf6, 0xdc, 0x43, 0x2b, 0xce, 0xd0, 0x5c, 0x58, 0xc3, 0xf2, + 0xa0, 0x72, 0x76, 0xfc, 0x68, 0x34, 0x38, 0x75, 0x8b, 0xeb, 0x3a, 0x67, 0x64, 0xa1, 0x68, 0xd8, + 0x2c, 0xff, 0xf8, 0x6b, 0xab, 0x70, 0xf2, 0xc9, 0x8b, 0xab, 0x96, 0xf3, 0xf2, 0xaa, 0xe5, 0xfc, + 0x79, 0xd5, 0x72, 0x7e, 0xba, 0x6e, 0x15, 0x5e, 0x5e, 0xb7, 0x0a, 0xbf, 0x5f, 0xb7, 0x0a, 0xdf, + 0xdc, 0xcd, 0xed, 0xfa, 0x33, 0x26, 0x49, 0x5f, 0x48, 0xda, 0x53, 0x74, 0x46, 0x58, 0xef, 0xe9, + 0x3f, 0x7e, 0xa4, 0xf6, 0x00, 0x26, 0x15, 0xfb, 0x17, 0xfb, 0xe8, 0xef, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x18, 0x74, 0x16, 0xf4, 0x69, 0x07, 0x00, 0x00, } func (this *DepositWhitelist) Equal(that interface{}) bool { @@ -659,7 +653,7 @@ func (this *Collective) Equal(that interface{}) bool { if this.ClaimEnd != that1.ClaimEnd { return false } - if this.VoteQuorum != that1.VoteQuorum { + if !this.VoteQuorum.Equal(that1.VoteQuorum) { return false } if this.VotePeriod != that1.VotePeriod { @@ -936,11 +930,16 @@ func (m *Collective) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x58 } - if m.VoteQuorum != 0 { - i = encodeVarintCollective(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x50 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCollective(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x52 if m.ClaimEnd != 0 { i = encodeVarintCollective(dAtA, i, uint64(m.ClaimEnd)) i-- @@ -1197,9 +1196,8 @@ func (m *Collective) Size() (n int) { if m.ClaimEnd != 0 { n += 1 + sovCollective(uint64(m.ClaimEnd)) } - if m.VoteQuorum != 0 { - n += 1 + sovCollective(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovCollective(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovCollective(uint64(m.VotePeriod)) } @@ -1992,10 +1990,10 @@ func (m *Collective) Unmarshal(dAtA []byte) error { } } case 10: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCollective @@ -2005,11 +2003,26 @@ func (m *Collective) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCollective + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCollective + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/collectives/types/msgs.go b/x/collectives/types/msgs.go index d902f72aa..efd4dc90c 100644 --- a/x/collectives/types/msgs.go +++ b/x/collectives/types/msgs.go @@ -15,8 +15,9 @@ func NewMsgCreateCollective( depositWhitelist DepositWhitelist, ownersWhitelist OwnersWhitelist, weightedSpendingPool []WeightedSpendingPool, - claimStart, claimPeriod, claimEnd, - voteQuorum, votePeriod, voteEnactment uint64, + claimStart, claimPeriod, claimEnd uint64, + voteQuorum sdk.Dec, + votePeriod, voteEnactment uint64, ) *MsgCreateCollective { return &MsgCreateCollective{ Sender: proposer.String(), @@ -75,7 +76,7 @@ func (m *MsgCreateCollective) ValidateBasic() error { if m.ClaimPeriod == 0 { return ErrInvalidClaimPeriod } - if m.VoteQuorum == 0 { + if m.VoteQuorum.IsZero() { return ErrInvalidVoteQuorum } if m.VotePeriod == 0 { diff --git a/x/collectives/types/proposal.go b/x/collectives/types/proposal.go index a55a99d16..85a72b98d 100644 --- a/x/collectives/types/proposal.go +++ b/x/collectives/types/proposal.go @@ -41,8 +41,9 @@ func NewProposalCollectiveUpdate( depositWhitelist DepositWhitelist, ownersWhitelist OwnersWhitelist, weightedSpendingPool []WeightedSpendingPool, - claimStart, claimPeriod, claimEnd, - voteQuorum, votePeriod, voteEnactment uint64, + claimStart, claimPeriod, claimEnd uint64, + voteQuorum sdk.Dec, + votePeriod, voteEnactment uint64, ) *ProposalCollectiveUpdate { return &ProposalCollectiveUpdate{ Name: name, diff --git a/x/collectives/types/proposal.pb.go b/x/collectives/types/proposal.pb.go index 757ae60f3..7409a7def 100644 --- a/x/collectives/types/proposal.pb.go +++ b/x/collectives/types/proposal.pb.go @@ -81,18 +81,18 @@ func (m *ProposalCollectiveSendDonation) GetAddress() string { // proposal to update staking collective, e.g. change description, owners, contributors, spending-pool list, claim period, etc. type ProposalCollectiveUpdate struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Status CollectiveStatus `protobuf:"varint,3,opt,name=status,proto3,enum=kira.collectives.CollectiveStatus" json:"status,omitempty"` - DepositWhitelist DepositWhitelist `protobuf:"bytes,4,opt,name=deposit_whitelist,json=depositWhitelist,proto3" json:"deposit_whitelist"` - OwnersWhitelist OwnersWhitelist `protobuf:"bytes,5,opt,name=owners_whitelist,json=ownersWhitelist,proto3" json:"owners_whitelist"` - SpendingPools []WeightedSpendingPool `protobuf:"bytes,6,rep,name=spending_pools,json=spendingPools,proto3" json:"spending_pools"` - ClaimStart uint64 `protobuf:"varint,7,opt,name=claim_start,json=claimStart,proto3" json:"claim_start,omitempty"` - ClaimPeriod uint64 `protobuf:"varint,8,opt,name=claim_period,json=claimPeriod,proto3" json:"claim_period,omitempty"` - ClaimEnd uint64 `protobuf:"varint,9,opt,name=claim_end,json=claimEnd,proto3" json:"claim_end,omitempty"` - VoteQuorum uint64 `protobuf:"varint,10,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` - VotePeriod uint64 `protobuf:"varint,11,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` - VoteEnactment uint64 `protobuf:"varint,12,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Status CollectiveStatus `protobuf:"varint,3,opt,name=status,proto3,enum=kira.collectives.CollectiveStatus" json:"status,omitempty"` + DepositWhitelist DepositWhitelist `protobuf:"bytes,4,opt,name=deposit_whitelist,json=depositWhitelist,proto3" json:"deposit_whitelist"` + OwnersWhitelist OwnersWhitelist `protobuf:"bytes,5,opt,name=owners_whitelist,json=ownersWhitelist,proto3" json:"owners_whitelist"` + SpendingPools []WeightedSpendingPool `protobuf:"bytes,6,rep,name=spending_pools,json=spendingPools,proto3" json:"spending_pools"` + ClaimStart uint64 `protobuf:"varint,7,opt,name=claim_start,json=claimStart,proto3" json:"claim_start,omitempty"` + ClaimPeriod uint64 `protobuf:"varint,8,opt,name=claim_period,json=claimPeriod,proto3" json:"claim_period,omitempty"` + ClaimEnd uint64 `protobuf:"varint,9,opt,name=claim_end,json=claimEnd,proto3" json:"claim_end,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` + VotePeriod uint64 `protobuf:"varint,11,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` + VoteEnactment uint64 `protobuf:"varint,12,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` } func (m *ProposalCollectiveUpdate) Reset() { *m = ProposalCollectiveUpdate{} } @@ -191,13 +191,6 @@ func (m *ProposalCollectiveUpdate) GetClaimEnd() uint64 { return 0 } -func (m *ProposalCollectiveUpdate) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *ProposalCollectiveUpdate) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -266,43 +259,44 @@ func init() { func init() { proto.RegisterFile("kira/collectives/proposal.proto", fileDescriptor_6173a479da28660d) } var fileDescriptor_6173a479da28660d = []byte{ - // 567 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xc7, 0xe3, 0x5f, 0xf3, 0x6b, 0x9a, 0x4d, 0xff, 0xb1, 0xe2, 0xb0, 0x14, 0xc9, 0x71, 0x2b, - 0x01, 0xbe, 0xc4, 0x96, 0xca, 0xad, 0x17, 0xa4, 0xa4, 0x15, 0x42, 0x1c, 0x08, 0x8e, 0xaa, 0x4a, - 0x5c, 0xa2, 0xad, 0x77, 0x95, 0xac, 0x62, 0xef, 0x18, 0xef, 0x26, 0x85, 0xb7, 0xe0, 0x11, 0x38, - 0x73, 0xe6, 0x21, 0x2a, 0x4e, 0x3d, 0x22, 0x0e, 0x15, 0x4a, 0x0e, 0xf0, 0x18, 0xc8, 0x6b, 0xa7, - 0x75, 0xe3, 0x9c, 0xbc, 0xfb, 0x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, 0xe3, 0x14, 0xd2, 0x69, 0x4c, 0x50, 0x9e, 0x20, 0x93, 0xde, 0x1b, 0xe5, - 0x0e, 0x28, 0xfc, 0x5b, 0xf7, 0x40, 0x61, 0xff, 0x0c, 0xed, 0x1a, 0x80, 0x4b, 0x1a, 0xea, 0x98, - 0x4b, 0x4d, 0xb6, 0x0d, 0xb3, 0x93, 0xa9, 0x67, 0x4b, 0xb1, 0x3a, 0x69, 0xaf, 0xd6, 0x0d, 0x5a, - 0xc0, 0x63, 0x98, 0xad, 0x1d, 0xb4, 0x8a, 0x41, 0xf7, 0xf5, 0xf5, 0xdc, 0xb6, 0x6e, 0xe6, 0xb6, - 0xf5, 0x7b, 0x6e, 0x5b, 0x5f, 0x16, 0x76, 0xed, 0x66, 0x61, 0xd7, 0x7e, 0x2e, 0xec, 0xda, 0x87, - 0x4e, 0x69, 0x0f, 0xde, 0x8a, 0x94, 0xf6, 0x20, 0xe5, 0xbe, 0xe2, 0x13, 0x2a, 0xfc, 0x4f, 0x0f, - 0x76, 0xd5, 0xac, 0xc4, 0xe5, 0xa6, 0xd9, 0xd3, 0x97, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xeb, - 0x04, 0x0f, 0xe5, 0x30, 0x04, 0x00, 0x00, + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbf, 0x6e, 0xdb, 0x3c, + 0x14, 0xc5, 0xad, 0x2f, 0x4e, 0x1c, 0xd3, 0xf9, 0xf7, 0x11, 0x1d, 0xd8, 0x14, 0x90, 0x9d, 0x00, + 0x4d, 0xb5, 0x44, 0x02, 0xd2, 0x2d, 0x4b, 0x01, 0x3b, 0x41, 0x51, 0x74, 0x48, 0x2a, 0x23, 0x08, + 0xd0, 0xc5, 0x60, 0xc4, 0x0b, 0x87, 0x88, 0xc4, 0xab, 0x8a, 0x74, 0xd2, 0xbe, 0x45, 0xb7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xb6, 0x44, 0xb1, 0xe8, 0xd8, + 0x4a, 0xf4, 0x09, 0x69, 0x17, 0x08, 0x28, 0xc1, 0xda, 0xb6, 0xbe, 0x6c, 0x85, 0x43, 0x25, 0xe8, + 0x11, 0xe9, 0x5c, 0xa2, 0x81, 0xd1, 0xbb, 0x09, 0x66, 0x93, 0x84, 0x91, 0xfc, 0xf7, 0xf5, 0xfd, + 0xb2, 0x9f, 0x76, 0xfe, 0xa1, 0x9f, 0x0e, 0x20, 0x0a, 0x49, 0x6e, 0xf1, 0xc6, 0x3a, 0xe4, 0x89, + 0xad, 0x61, 0x99, 0xa7, 0x53, 0x24, 0xce, 0xa5, 0x32, 0xce, 0x53, 0xb2, 0x66, 0x01, 0x50, 0x3c, + 0x32, 0x09, 0x28, 0xc3, 0x56, 0x2c, 0xb3, 0x9a, 0xab, 0x87, 0x53, 0xb1, 0xde, 0x99, 0x2f, 0xe6, + 0x35, 0x66, 0x08, 0x09, 0x5e, 0xce, 0x6d, 0xcc, 0x9a, 0x41, 0xff, 0xe5, 0xf5, 0x9d, 0xeb, 0xdc, + 0xdc, 0xb9, 0xce, 0xcf, 0x3b, 0xd7, 0xf9, 0x78, 0xef, 0x36, 0x6e, 0xee, 0xdd, 0xc6, 0xf7, 0x7b, + 0xb7, 0xf1, 0x76, 0xb7, 0x72, 0xce, 0xd7, 0x32, 0xe3, 0x03, 0xcc, 0x20, 0xd0, 0x70, 0xc1, 0x65, + 0xf0, 0xfe, 0xc1, 0xdb, 0xb6, 0x47, 0x3e, 0x5b, 0xb2, 0xef, 0xfa, 0xf9, 0xef, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x1a, 0xfc, 0x12, 0x4d, 0x60, 0x04, 0x00, 0x00, } func (this *ProposalCollectiveSendDonation) Equal(that interface{}) bool { @@ -391,7 +385,7 @@ func (this *ProposalCollectiveUpdate) Equal(that interface{}) bool { if this.ClaimEnd != that1.ClaimEnd { return false } - if this.VoteQuorum != that1.VoteQuorum { + if !this.VoteQuorum.Equal(that1.VoteQuorum) { return false } if this.VotePeriod != that1.VotePeriod { @@ -507,11 +501,16 @@ func (m *ProposalCollectiveUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x58 } - if m.VoteQuorum != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x50 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintProposal(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x52 if m.ClaimEnd != 0 { i = encodeVarintProposal(dAtA, i, uint64(m.ClaimEnd)) i-- @@ -683,9 +682,8 @@ func (m *ProposalCollectiveUpdate) Size() (n int) { if m.ClaimEnd != 0 { n += 1 + sovProposal(uint64(m.ClaimEnd)) } - if m.VoteQuorum != 0 { - n += 1 + sovProposal(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovProposal(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovProposal(uint64(m.VotePeriod)) } @@ -1134,10 +1132,10 @@ func (m *ProposalCollectiveUpdate) Unmarshal(dAtA []byte) error { } } case 10: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProposal @@ -1147,11 +1145,26 @@ func (m *ProposalCollectiveUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/collectives/types/tx.pb.go b/x/collectives/types/tx.pb.go index 62e97c938..b8c152d67 100644 --- a/x/collectives/types/tx.pb.go +++ b/x/collectives/types/tx.pb.go @@ -43,7 +43,7 @@ type MsgCreateCollective struct { ClaimStart uint64 `protobuf:"varint,8,opt,name=claim_start,json=claimStart,proto3" json:"claim_start,omitempty"` ClaimPeriod uint64 `protobuf:"varint,9,opt,name=claim_period,json=claimPeriod,proto3" json:"claim_period,omitempty"` ClaimEnd uint64 `protobuf:"varint,10,opt,name=claim_end,json=claimEnd,proto3" json:"claim_end,omitempty"` - VoteQuorum uint64 `protobuf:"varint,11,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` VotePeriod uint64 `protobuf:"varint,12,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` VoteEnactment uint64 `protobuf:"varint,13,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` } @@ -144,13 +144,6 @@ func (m *MsgCreateCollective) GetClaimEnd() uint64 { return 0 } -func (m *MsgCreateCollective) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *MsgCreateCollective) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -501,54 +494,54 @@ func init() { func init() { proto.RegisterFile("kira/collectives/tx.proto", fileDescriptor_0cc3032dd5313583) } var fileDescriptor_0cc3032dd5313583 = []byte{ - // 743 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x4e, 0xdb, 0x4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xea, 0x75, 0xb9, 0x30, - 0x03, 0xa1, 0xe5, 0x6a, 0x4a, 0x43, 0x35, 0x90, 0x84, 0x4e, 0x42, 0x04, 0x6f, 0xa1, 0xe5, 0x88, - 0xe0, 0x93, 0x80, 0x82, 0xad, 0xe5, 0x25, 0x23, 0x4a, 0x3a, 0x96, 0x10, 0xde, 0x40, 0xf9, 0x88, - 0x42, 0x98, 0xad, 0x21, 0x19, 0xcf, 0x49, 0xe0, 0x88, 0xd9, 0x61, 0x81, 0x33, 0x10, 0xa4, 0xfb, - 0x71, 0x08, 0xc1, 0xd0, 0xd3, 0x0a, 0x51, 0x81, 0x10, 0x7a, 0x2b, 0x91, 0x11, 0x21, 0xd6, 0x5f, - 0xbe, 0x27, 0xc4, 0xf2, 0x3b, 0x68, 0x45, 0x12, 0x08, 0x33, 0x2d, 0xe1, 0x11, 0x26, 0xb4, 0xa2, - 0xe4, 0x14, 0x43, 0xf4, 0x28, 0x01, 0x9f, 0xab, 0xbf, 0xbe, 0x54, 0x95, 0xfa, 0x26, 0xda, 0x98, - 0xe1, 0x3d, 0x83, 0x70, 0x1f, 0x18, 0x27, 0xf5, 0x4f, 0x0a, 0x5a, 0xed, 0x70, 0xa7, 0x05, 0xcc, - 0x7e, 0xa4, 0x33, 0x47, 0xbe, 0xcb, 0xfe, 0x8d, 0xef, 0xea, 0x1b, 0x68, 0x3d, 0x75, 0x8e, 0xd1, - 0x29, 0xbf, 0x29, 0x72, 0x82, 0x0e, 0x81, 0x3d, 0x7e, 0x82, 0x34, 0xb4, 0xe4, 0x82, 0x35, 0xa0, - 0xcc, 0x91, 0xd3, 0xa3, 0x1a, 0xc9, 0x16, 0xbf, 0x44, 0x39, 0x3b, 0x54, 0x0e, 0x07, 0x4b, 0x0d, - 0x33, 0x5a, 0xcd, 0xb8, 0x89, 0xdd, 0x39, 0x9a, 0x38, 0x24, 0x96, 0x31, 0xca, 0xc7, 0xdb, 0xa8, - 0x98, 0xac, 0xbb, 0xa1, 0xbe, 0x1c, 0x9d, 0x9c, 0xb1, 0x9c, 0x80, 0xaf, 0xc1, 0x1a, 0xc4, 0x77, - 0x32, 0xdd, 0xcd, 0xa8, 0xdb, 0x36, 0xfa, 0xbf, 0xc3, 0x9d, 0x53, 0x2a, 0xfa, 0x76, 0x60, 0x9e, - 0x3f, 0xae, 0xdd, 0x7a, 0x15, 0x6d, 0xce, 0x14, 0x49, 0xaa, 0x1c, 0x7c, 0xcd, 0xa2, 0x6c, 0x87, - 0x3b, 0xb8, 0x8f, 0x4a, 0xa9, 0x2f, 0xd3, 0x4e, 0x7a, 0x82, 0x66, 0x98, 0xa8, 0xbc, 0x3f, 0x17, - 0x2d, 0xa9, 0x88, 0xfb, 0x68, 0xad, 0x0d, 0x4c, 0x04, 0xb4, 0x37, 0x9c, 0xa8, 0xb6, 0x3d, 0x53, - 0x66, 0xd2, 0x0a, 0xe5, 0xa7, 0x73, 0x90, 0xc6, 0x2a, 0x95, 0x52, 0x5e, 0x99, 0xdd, 0xd3, 0x34, - 0xed, 0x81, 0x9e, 0x1e, 0xba, 0x2b, 0xcc, 0x10, 0x9e, 0x71, 0x51, 0x7b, 0x33, 0x45, 0xd2, 0xc4, - 0xb2, 0x3e, 0x27, 0x31, 0xa9, 0xd7, 0x7a, 0x71, 0x75, 0x5b, 0x51, 0xae, 0x6f, 0x2b, 0xca, 0xcf, - 0xdb, 0x8a, 0xf2, 0xf9, 0xae, 0x92, 0xb9, 0xbe, 0xab, 0x64, 0xbe, 0xdf, 0x55, 0x32, 0xef, 0xf7, - 0xc7, 0xbc, 0xfa, 0x8a, 0x06, 0x66, 0x1b, 0x02, 0xa2, 0x73, 0x32, 0x30, 0xa9, 0x7e, 0x31, 0xf9, - 0x72, 0x86, 0xb6, 0xed, 0x2d, 0xca, 0xb7, 0xe9, 0xd9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, - 0x31, 0x24, 0x58, 0x5a, 0x07, 0x00, 0x00, + // 748 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xda, 0x40, + 0x10, 0xc6, 0x85, 0x24, 0xb0, 0x84, 0x94, 0x6c, 0xd3, 0xca, 0x21, 0x0a, 0x10, 0xa2, 0x24, 0x48, + 0x55, 0xb0, 0x94, 0xde, 0x7a, 0x84, 0x44, 0x95, 0xda, 0xa2, 0xa4, 0x8e, 0xaa, 0x48, 0xbd, 0x20, + 0x63, 0x6f, 0xcd, 0x0a, 0x7b, 0xc7, 0xf5, 0x2e, 0xf9, 0x79, 0x81, 0x9e, 0xfb, 0x08, 0x3d, 0xf7, + 0xda, 0x97, 0xc8, 0xa1, 0x87, 0x1c, 0xab, 0x1e, 0xa2, 0x2a, 0xb9, 0xf4, 0x31, 0x2a, 0xaf, 0x6d, + 0x0a, 0x98, 0x48, 0x88, 0x9e, 0xd8, 0xfd, 0xe6, 0x9b, 0x6f, 0x66, 0x98, 0x19, 0x2f, 0x5a, 0xef, + 0x53, 0xdf, 0xd0, 0x4c, 0x70, 0x1c, 0x62, 0x0a, 0x7a, 0x4e, 0xb8, 0x26, 0x2e, 0x1b, 0x9e, 0x0f, + 0x02, 0x70, 0x31, 0x30, 0x35, 0x46, 0x4c, 0xa5, 0x35, 0x1b, 0x6c, 0x90, 0x46, 0x2d, 0x38, 0x85, + 0xbc, 0xd2, 0xba, 0x0d, 0x60, 0x3b, 0x44, 0x93, 0xb7, 0xee, 0xe0, 0xa3, 0x66, 0xb0, 0xab, 0xd8, + 0x64, 0x02, 0x77, 0x81, 0x77, 0x42, 0x9f, 0xf0, 0x12, 0x99, 0x2a, 0x93, 0x5e, 0x82, 0xba, 0x84, + 0x0b, 0xc3, 0xf5, 0x22, 0xc2, 0x56, 0x22, 0xb3, 0x7f, 0xe7, 0x90, 0x52, 0xfb, 0xb6, 0x80, 0x9e, + 0xb4, 0xb9, 0xdd, 0xf2, 0x89, 0x21, 0x48,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 0xdd, 0x45, 0xf9, 0x96, 0xbd, 0xf8, 0x1b, + 0x00, 0x00, 0xff, 0xff, 0xc5, 0x10, 0x2b, 0x29, 0x8a, 0x07, 0x00, 0x00, } func (this *MsgCreateCollective) Equal(that interface{}) bool { @@ -610,7 +603,7 @@ func (this *MsgCreateCollective) Equal(that interface{}) bool { if this.ClaimEnd != that1.ClaimEnd { return false } - if this.VoteQuorum != that1.VoteQuorum { + if !this.VoteQuorum.Equal(that1.VoteQuorum) { return false } if this.VotePeriod != that1.VotePeriod { @@ -862,11 +855,16 @@ func (m *MsgCreateCollective) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x60 } - if m.VoteQuorum != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x58 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x5a if m.ClaimEnd != 0 { i = encodeVarintTx(dAtA, i, uint64(m.ClaimEnd)) i-- @@ -1250,9 +1248,8 @@ func (m *MsgCreateCollective) Size() (n int) { if m.ClaimEnd != 0 { n += 1 + sovTx(uint64(m.ClaimEnd)) } - if m.VoteQuorum != 0 { - n += 1 + sovTx(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovTx(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovTx(uint64(m.VotePeriod)) } @@ -1688,10 +1685,10 @@ func (m *MsgCreateCollective) Unmarshal(dAtA []byte) error { } } case 11: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1701,11 +1698,26 @@ func (m *MsgCreateCollective) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 12: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/custody/types/msg.go b/x/custody/types/msg.go index a26dfd452..2d1a4fea0 100644 --- a/x/custody/types/msg.go +++ b/x/custody/types/msg.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -426,20 +427,20 @@ func (m MsgSend) Type() string { func (m MsgSend) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.FromAddress) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } _, err = sdk.AccAddressFromBech32(m.ToAddress) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid recipient address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid recipient address (%s)", err) } if !m.Amount.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) } if !m.Amount.IsAllPositive() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) } return nil diff --git a/x/evidence/keeper/keeper.go b/x/evidence/keeper/keeper.go index d2d23f675..0280ad7f4 100644 --- a/x/evidence/keeper/keeper.go +++ b/x/evidence/keeper/keeper.go @@ -6,13 +6,13 @@ import ( tmbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cometbft/cometbft/libs/log" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/evidence/exported" "github.com/KiraCore/sekai/x/evidence/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Keeper defines the evidence module's keeper. The keeper is responsible for @@ -67,7 +67,7 @@ func (k *Keeper) SetRouter(rtr types.Router) { // no handler exists, an error is returned. func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error) { if !k.router.HasRoute(evidenceRoute) { - return nil, sdkerrors.Wrap(types.ErrNoEvidenceHandlerExists, evidenceRoute) + return nil, errorsmod.Wrap(types.ErrNoEvidenceHandlerExists, evidenceRoute) } return k.router.GetRoute(evidenceRoute), nil @@ -79,15 +79,15 @@ func (k Keeper) GetEvidenceHandler(evidenceRoute string) (types.Handler, error) // persisted. func (k Keeper) SubmitEvidence(ctx sdk.Context, evidence exported.Evidence) error { if _, ok := k.GetEvidence(ctx, evidence.Hash()); ok { - return sdkerrors.Wrap(types.ErrEvidenceExists, evidence.Hash().String()) + return errorsmod.Wrap(types.ErrEvidenceExists, evidence.Hash().String()) } if !k.router.HasRoute(evidence.Route()) { - return sdkerrors.Wrap(types.ErrNoEvidenceHandlerExists, evidence.Route()) + return errorsmod.Wrap(types.ErrNoEvidenceHandlerExists, evidence.Route()) } handler := k.router.GetRoute(evidence.Route()) if err := handler(ctx, evidence); err != nil { - return sdkerrors.Wrap(types.ErrInvalidEvidence, err.Error()) + return errorsmod.Wrap(types.ErrInvalidEvidence, err.Error()) } ctx.EventManager().EmitEvent( diff --git a/x/evidence/types/msgs.go b/x/evidence/types/msgs.go index a3096feeb..2cdb52de9 100644 --- a/x/evidence/types/msgs.go +++ b/x/evidence/types/msgs.go @@ -3,6 +3,7 @@ package types import ( "fmt" + errorsmod "cosmossdk.io/errors" kiratypes "github.com/KiraCore/sekai/types" "github.com/KiraCore/sekai/x/evidence/exported" "github.com/cosmos/cosmos-sdk/codec/types" @@ -18,6 +19,7 @@ var ( ) // NewMsgSubmitEvidence returns a new MsgSubmitEvidence with a signer/submitter. +// //nolint:interfacer func NewMsgSubmitEvidence(s sdk.AccAddress, evi exported.Evidence) (*MsgSubmitEvidence, error) { msg, ok := evi.(proto.Message) @@ -40,12 +42,12 @@ func (m MsgSubmitEvidence) Type() string { return kiratypes.TypeMsgSubmitEvidenc // ValidateBasic performs basic (non-state-dependant) validation on a MsgSubmitEvidence. func (m MsgSubmitEvidence) ValidateBasic() error { if m.Submitter == "" { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Submitter) + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, m.Submitter) } evi := m.GetEvidence() if evi == nil { - return sdkerrors.Wrap(ErrInvalidEvidence, "missing evidence") + return errorsmod.Wrap(ErrInvalidEvidence, "missing evidence") } if err := evi.ValidateBasic(); err != nil { return err diff --git a/x/genutil/client/cli/init.go b/x/genutil/client/cli/init.go index f9ad74064..33cf80371 100644 --- a/x/genutil/client/cli/init.go +++ b/x/genutil/client/cli/init.go @@ -9,6 +9,8 @@ import ( "github.com/KiraCore/sekai/x/genutil" govtypes "github.com/KiraCore/sekai/x/gov/types" + spendingtypes "github.com/KiraCore/sekai/x/spending/types" + tokenstypes "github.com/KiraCore/sekai/x/tokens/types" cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/cli" tmos "github.com/cometbft/cometbft/libs/os" @@ -128,6 +130,41 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { return err } + tokenGenState := tokenstypes.GetGenesisStateFromAppState(clientCtx.Codec, genesis) + tokenGenState.Aliases = []*tokenstypes.TokenAlias{ + { + Symbol: defaultDenom, + Name: defaultDenom, + Icon: "", + Decimals: 6, + Denoms: []string{defaultDenom}, + Invalidated: false, + }, + } + tokenGenState.Rates = []*tokenstypes.TokenRate{ + { + Denom: defaultDenom, + FeeRate: sdk.OneDec(), + FeePayments: true, + StakeCap: sdk.NewDecWithPrec(5, 1), // 0.5 + StakeMin: sdk.OneInt(), + StakeToken: true, + Invalidated: false, + }, + } + tokenGenState.TokenBlackWhites.Whitelisted = []string{defaultDenom} + genesis[tokenstypes.ModuleName], err = cdc.MarshalJSON(&tokenGenState) + if err != nil { + return err + } + + spendingGenState := spendingtypes.GetGenesisStateFromAppState(clientCtx.Codec, genesis) + spendingGenState.Pools[0].Rates[0].Denom = defaultDenom + genesis[spendingtypes.ModuleName], err = cdc.MarshalJSON(&spendingGenState) + if err != nil { + return err + } + appState, err := json.MarshalIndent(genesis, "", " ") if err != nil { return errors.Wrap(err, "Failed to marshall default genesis state") diff --git a/x/genutil/client/cli/upgrade_genesis.go b/x/genutil/client/cli/upgrade_genesis.go index 3dc6235b4..d15af9c23 100644 --- a/x/genutil/client/cli/upgrade_genesis.go +++ b/x/genutil/client/cli/upgrade_genesis.go @@ -160,7 +160,7 @@ $ %s new-genesis-from-exported exported-genesis.json new-genesis.json NetworkProperties: &govtypes.NetworkProperties{ MinTxFee: govGenesisV01228.NetworkProperties.MinTxFee, MaxTxFee: govGenesisV01228.NetworkProperties.MaxTxFee, - VoteQuorum: govGenesisV01228.NetworkProperties.VoteQuorum, + VoteQuorum: sdk.NewDecWithPrec(int64(govGenesisV01228.NetworkProperties.VoteQuorum), 2), MinimumProposalEndTime: govGenesisV01228.NetworkProperties.ProposalEndTime, ProposalEnactmentTime: govGenesisV01228.NetworkProperties.ProposalEnactmentTime, MinProposalEndBlocks: govGenesisV01228.NetworkProperties.MinProposalEndBlocks, @@ -186,7 +186,7 @@ $ %s new-genesis-from-exported exported-genesis.json new-genesis.json MinDelegationPushout: 10, SlashingPeriod: 3600, MaxJailedPercentage: sdk.NewDecWithPrec(25, 2), - MaxSlashingPercentage: sdk.NewDecWithPrec(1, 2), + MaxSlashingPercentage: sdk.NewDecWithPrec(5, 3), // 0.5% MinCustodyReward: 200, MaxCustodyTxSize: 8192, MaxCustodyBufferSize: 10, @@ -209,12 +209,15 @@ $ %s new-genesis-from-exported exported-genesis.json new-genesis.json DappAutoDenounceTime: 60, // 60s DappMischanceRankDecreaseAmount: 1, DappMaxMischance: 10, - DappInactiveRankDecreasePercent: 10, + DappInactiveRankDecreasePercent: sdk.NewDecWithPrec(10, 2), DappPoolSlippageDefault: sdk.NewDecWithPrec(1, 1), // 10% + DappLiquidationThreshold: 100_000_000_000, // default 100’000 KEX + DappLiquidationPeriod: 2419200, // default 2419200, ~28d MintingFtFee: 100_000_000_000_000, MintingNftFee: 100_000_000_000_000, - VetoThreshold: sdk.NewDecWithPrec(3340, 2), //33.40% + VetoThreshold: sdk.NewDecWithPrec(3340, 4), //33.40% AutocompoundIntervalNumBlocks: 17280, + DowntimeInactiveDuration: 600, }, ExecutionFees: govGenesisV01228.ExecutionFees, PoorNetworkMessages: govGenesisV01228.PoorNetworkMessages, diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index e3d72f37c..b586fa146 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -57,6 +57,11 @@ const ( FlagPollReference = "poll-reference" FlagPollChecksum = "poll-checksum" FlagCustomPollValue = "poll-custom-value" + FlagTxTypes = "tx-types" + FlagExecutionFees = "execution-fees" + FlagFailureFees = "failure-fees" + FlagTimeouts = "timeouts" + FlagDefaultParams = "default-params" ) // NewTxCmd returns a root CLI command handler for all x/bank transaction commands. @@ -225,6 +230,9 @@ func GetTxSetWhitelistPermissions() *cobra.Command { Short: "Assign permission to a kira address whitelist", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } perm, err := cmd.Flags().GetUint32(FlagPermission) if err != nil { @@ -260,6 +268,9 @@ func GetTxRemoveWhitelistedPermissions() *cobra.Command { Short: "Remove whitelisted permission from an address", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } perm, err := cmd.Flags().GetUint32(FlagPermission) if err != nil { @@ -397,17 +408,64 @@ func NewTxSetNetworkProperties() *cobra.Command { msg := types.NewMsgSetNetworkProperties( clientCtx.FromAddress, &types.NetworkProperties{ - MinTxFee: minTxFee, - MaxTxFee: maxTxFee, - VoteQuorum: 33, - MinimumProposalEndTime: 300, // 5min - ProposalEnactmentTime: 300, // 5min - EnableForeignFeePayments: true, - MischanceRankDecreaseAmount: 10, - InactiveRankDecreasePercent: sdk.NewDecWithPrec(50, 2), // 50% - PoorNetworkMaxBankSend: 1000000, // 1M ukex - MinValidators: minValidators, - MinCustodyReward: minCustodyReward, + MinTxFee: minTxFee, + MaxTxFee: maxTxFee, + VoteQuorum: sdk.NewDecWithPrec(33, 2), // 33% + MinimumProposalEndTime: 300, // 5min + ProposalEnactmentTime: 300, // 5min + EnableForeignFeePayments: true, + MischanceRankDecreaseAmount: 10, + InactiveRankDecreasePercent: sdk.NewDecWithPrec(50, 2), // 50% + PoorNetworkMaxBankSend: 1000000, // 1M ukex + MinValidators: minValidators, + MinCustodyReward: minCustodyReward, + MinProposalEndBlocks: 2, + MinProposalEnactmentBlocks: 1, + MaxMischance: 1, + MinIdentityApprovalTip: 200, + UniqueIdentityKeys: "moniker,username", + UbiHardcap: 6000_000, + ValidatorsFeeShare: sdk.NewDecWithPrec(50, 2), // 50% + InflationRate: sdk.NewDecWithPrec(18, 2), // 18% + InflationPeriod: 31557600, // 1 year + UnstakingPeriod: 2629800, // 1 month + MaxDelegators: 100, + MinDelegationPushout: 10, + SlashingPeriod: 2629800, + MaxJailedPercentage: sdk.NewDecWithPrec(25, 2), + MaxSlashingPercentage: sdk.NewDecWithPrec(5, 3), // 0.5% + MaxCustodyBufferSize: 10, + MaxCustodyTxSize: 8192, + AbstentionRankDecreaseAmount: 1, + MaxAbstention: 2, + MinCollectiveBond: 100_000, // in KEX + MinCollectiveBondingTime: 86400, // in seconds + MaxCollectiveOutputs: 10, + MinCollectiveClaimPeriod: 14400, // 4hrs + ValidatorRecoveryBond: 300000, // 300k KEX + MaxAnnualInflation: sdk.NewDecWithPrec(35, 2), // 35% + MaxProposalTitleSize: 128, + MaxProposalDescriptionSize: 1024, + MaxProposalPollOptionSize: 64, + MaxProposalPollOptionCount: 128, + MaxProposalReferenceSize: 512, + MaxProposalChecksumSize: 128, + MinDappBond: 1000000, + MaxDappBond: 10000000, + DappBondDuration: 604800, + DappVerifierBond: sdk.NewDecWithPrec(1, 3), //0.1% + DappAutoDenounceTime: 60, // 60s + DappMischanceRankDecreaseAmount: 1, + DappMaxMischance: 10, + DappInactiveRankDecreasePercent: sdk.NewDecWithPrec(10, 2), // 10% + DappPoolSlippageDefault: sdk.NewDecWithPrec(1, 1), // 10% + DappLiquidationThreshold: 100_000_000_000, // default 100’000 KEX + DappLiquidationPeriod: 2419200, // default 2419200, ~28d + MintingFtFee: 100_000_000_000_000, + MintingNftFee: 100_000_000_000_000, + VetoThreshold: sdk.NewDecWithPrec(3340, 4), // 33.40% + AutocompoundIntervalNumBlocks: 17280, + DowntimeInactiveDuration: 600, }, ) @@ -785,9 +843,65 @@ func GetTxProposalSetNetworkProperty() *cobra.Command { MIN_TX_FEE MAX_TX_FEE VOTE_QUORUM - PROPOSAL_END_TIME + MINIMUM_PROPOSAL_END_TIME PROPOSAL_ENACTMENT_TIME - ENABLE_FOREIGN_TX_FEE_PAYMENTS + MIN_PROPOSAL_END_BLOCKS + MIN_PROPOSAL_ENACTMENT_BLOCKS + ENABLE_FOREIGN_FEE_PAYMENTS + MISCHANCE_RANK_DECREASE_AMOUNT + MAX_MISCHANCE + MISCHANCE_CONFIDENCE + INACTIVE_RANK_DECREASE_PERCENT + POOR_NETWORK_MAX_BANK_SEND + MIN_VALIDATORS + UNJAIL_MAX_TIME + ENABLE_TOKEN_WHITELIST + ENABLE_TOKEN_BLACKLIST + MIN_IDENTITY_APPROVAL_TIP + UNIQUE_IDENTITY_KEYS + UBI_HARDCAP + VALIDATORS_FEE_SHARE + INFLATION_RATE + INFLATION_PERIOD + UNSTAKING_PERIOD + MAX_DELEGATORS + MIN_DELEGATION_PUSHOUT + SLASHING_PERIOD + MAX_JAILED_PERCENTAGE + MAX_SLASHING_PERCENTAGE + MIN_CUSTODY_REWARD + MAX_CUSTODY_BUFFER_SIZE + MAX_CUSTODY_TX_SIZE + ABSTENTION_RANK_DECREASE_AMOUNT + MAX_ABSTENTION + MIN_COLLECTIVE_BOND + MIN_COLLECTIVE_BONDING_TIME + MAX_COLLECTIVE_OUTPUTS + MIN_COLLECTIVE_CLAIM_PERIOD + VALIDATOR_RECOVERY_BOND + MAX_ANNUAL_INFLATION + MAX_PROPOSAL_TITLE_SIZE + MAX_PROPOSAL_DESCRIPTION_SIZE + MAX_PROPOSAL_POLL_OPTION_SIZE + MAX_PROPOSAL_POLL_OPTION_COUNT + MAX_PROPOSAL_REFERENCE_SIZE + MAX_PROPOSAL_CHECKSUM_SIZE + MIN_DAPP_BOND + MAX_DAPP_BOND + DAPP_LIQUIDATION_THRESHOLD + DAPP_LIQUIDATION_PERIOD + DAPP_BOND_DURATION + DAPP_VERIFIER_BOND + DAPP_AUTO_DENOUNCE_TIME + DAPP_MISCHANCE_RANK_DECREASE_AMOUNT + DAPP_MAX_MISCHANCE + DAPP_INACTIVE_RANK_DECREASE_PERCENT + DAPP_POOL_SLIPPAGE_DEFAULT + MINTING_FT_FEE + MINTING_NFT_FEE + VETO_THRESHOLD + AUTOCOMPOUND_INTERVAL_NUM_BLOCKS + DOWNTIME_INACTIVE_DURATION `, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -803,9 +917,29 @@ func GetTxProposalSetNetworkProperty() *cobra.Command { value := types.NetworkPropertyValue{} switch types.NetworkProperty(property) { + case types.InactiveRankDecreasePercent: + fallthrough case types.UniqueIdentityKeys: - value.StrValue = args[1] + fallthrough case types.ValidatorsFeeShare: + fallthrough + case types.InflationRate: + fallthrough + case types.MaxJailedPercentage: + fallthrough + case types.MaxSlashingPercentage: + fallthrough + case types.MaxAnnualInflation: + fallthrough + case types.DappVerifierBond: + fallthrough + case types.DappPoolSlippageDefault: + fallthrough + case types.DappInactiveRankDecreasePercent: + fallthrough + case types.VoteQuorum: + fallthrough + case types.VetoThreshold: value.StrValue = args[1] default: numVal, err := strconv.Atoi(args[1]) @@ -2318,9 +2452,10 @@ func GetTxProposalJailCouncilorCmd() *cobra.Command { // GetTxProposalSetExecutionFeesCmd implement cli command for ProposalSetExecutionFees func GetTxProposalSetExecutionFeesCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "proposal-set-execution-fees [txTypes] [executionFees] [failureFees] [timeouts] [defaultParams]", - Short: "Create a proposal to set execution fees", - Args: cobra.ExactArgs(5), + Use: "proposal-set-execution-fees", + Short: "Create a proposal to set execution fees", + Example: `proposal-set-execution-fees --tx-types=[txTypes] --execution-fees=[executionFees] --failure-fees=[failureFees] --timeouts=[timeouts] --default-params=[defaultParams]`, + Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -2335,11 +2470,36 @@ func GetTxProposalSetExecutionFeesCmd() *cobra.Command { return fmt.Errorf("invalid description: %w", err) } - txTypes := strings.Split(args[0], ",") - execFeeStrs := strings.Split(args[1], ",") - failureFeeStrs := strings.Split(args[2], ",") - timeoutStrs := strings.Split(args[3], ",") - defaultParamStrs := strings.Split(args[3], ",") + txTypesStr, err := cmd.Flags().GetString(FlagTxTypes) + if err != nil { + return fmt.Errorf("invalid tx types: %w", err) + } + + execFeesStr, err := cmd.Flags().GetString(FlagExecutionFees) + if err != nil { + return fmt.Errorf("invalid execution fees: %w", err) + } + + failureFeesStr, err := cmd.Flags().GetString(FlagFailureFees) + if err != nil { + return fmt.Errorf("invalid failure fees: %w", err) + } + + timeoutsStr, err := cmd.Flags().GetString(FlagTimeouts) + if err != nil { + return fmt.Errorf("invalid timeouts: %w", err) + } + + defaultParamsStr, err := cmd.Flags().GetString(FlagTimeouts) + if err != nil { + return fmt.Errorf("invalid default params: %w", err) + } + + txTypes := strings.Split(txTypesStr, ",") + execFeeStrs := strings.Split(execFeesStr, ",") + failureFeeStrs := strings.Split(failureFeesStr, ",") + timeoutStrs := strings.Split(timeoutsStr, ",") + defaultParamStrs := strings.Split(defaultParamsStr, ",") executionFees := []types.ExecutionFee{} for i, txType := range txTypes { execFee, err := strconv.Atoi(execFeeStrs[i]) @@ -2385,6 +2545,11 @@ func GetTxProposalSetExecutionFeesCmd() *cobra.Command { cmd.MarkFlagRequired(FlagTitle) cmd.Flags().String(FlagDescription, "", "The description of the proposal, it can be a url, some text, etc.") cmd.MarkFlagRequired(FlagDescription) + cmd.Flags().String(FlagTxTypes, "", "Transaction types to set execution fees") + cmd.Flags().String(FlagExecutionFees, "", "Execution fees") + cmd.Flags().String(FlagFailureFees, "", "Failure fees") + cmd.Flags().String(FlagTimeouts, "", "Timeouts") + cmd.Flags().String(FlagDefaultParams, "", "Default params") flags.AddTxFlagsToCmd(cmd) _ = cmd.MarkFlagRequired(flags.FlagFrom) diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 1c8402b2d..28f77f188 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -131,7 +131,7 @@ func TestSimappExportGenesis(t *testing.T) { "network_properties": { "min_tx_fee": "100", "max_tx_fee": "1000000", - "vote_quorum": "33", + "vote_quorum": "0.330000000000000000", "minimum_proposal_end_time": "300", "proposal_enactment_time": "300", "min_proposal_end_blocks": "2", @@ -155,9 +155,9 @@ func TestSimappExportGenesis(t *testing.T) { "unstaking_period": "2629800", "max_delegators": "100", "min_delegation_pushout": "10", - "slashing_period": "3600", + "slashing_period": "2629800", "max_jailed_percentage": "0.250000000000000000", - "max_slashing_percentage": "0.010000000000000000", + "max_slashing_percentage": "0.005000000000000000", "min_custody_reward": "200", "max_custody_buffer_size": "10", "max_custody_tx_size": "8192", @@ -177,19 +177,20 @@ func TestSimappExportGenesis(t *testing.T) { "max_proposal_checksum_size": "128", "min_dapp_bond": "1000000", "max_dapp_bond": "10000000", - "dapp_liquidation_threshold": "0", - "dapp_liquidation_period": "0", + "dapp_liquidation_threshold": "100000000000", + "dapp_liquidation_period": "2419200", "dapp_bond_duration": "604800", "dapp_verifier_bond": "0.001000000000000000", "dapp_auto_denounce_time": "60", "dapp_mischance_rank_decrease_amount": "1", "dapp_max_mischance": "10", - "dapp_inactive_rank_decrease_percent": "10", + "dapp_inactive_rank_decrease_percent": "0.100000000000000000", "dapp_pool_slippage_default": "0.100000000000000000", "minting_ft_fee": "100000000000000", "minting_nft_fee": "100000000000000", - "veto_threshold": "33.400000000000000000", - "autocompound_interval_num_blocks": "17280" + "veto_threshold": "0.334000000000000000", + "autocompound_interval_num_blocks": "17280", + "downtime_inactive_duration": "600" }, "execution_fees": [ { @@ -347,7 +348,7 @@ func TestExportInitGenesis(t *testing.T) { NetworkProperties: &types.NetworkProperties{ MinTxFee: 100, MaxTxFee: 1000000, - VoteQuorum: 33, + VoteQuorum: sdk.NewDecWithPrec(33, 2), MinimumProposalEndTime: 300, // 300 seconds / 5 mins ProposalEnactmentTime: 300, // 300 seconds / 5 mins MinProposalEndBlocks: 2, @@ -356,6 +357,7 @@ func TestExportInitGenesis(t *testing.T) { MaxMischance: 1, InactiveRankDecreasePercent: sdk.NewDecWithPrec(2, 2), MinValidators: 1, + UnjailMaxTime: 600, PoorNetworkMaxBankSend: 1, EnableForeignFeePayments: true, MinIdentityApprovalTip: 200, @@ -367,9 +369,9 @@ func TestExportInitGenesis(t *testing.T) { UnstakingPeriod: 2629800, // 1 month MaxDelegators: 100, MinDelegationPushout: 10, - SlashingPeriod: 3600, + SlashingPeriod: 2629800, MaxJailedPercentage: sdk.NewDecWithPrec(25, 2), - MaxSlashingPercentage: sdk.NewDecWithPrec(1, 2), + MaxSlashingPercentage: sdk.NewDecWithPrec(5, 3), // 0.5% MinCustodyReward: 200, MaxCustodyBufferSize: 10, MaxCustodyTxSize: 8192, @@ -394,12 +396,15 @@ func TestExportInitGenesis(t *testing.T) { DappAutoDenounceTime: 60, // 60s DappMischanceRankDecreaseAmount: 1, DappMaxMischance: 10, - DappInactiveRankDecreasePercent: 10, + DappInactiveRankDecreasePercent: sdk.NewDecWithPrec(10, 2), DappPoolSlippageDefault: sdk.NewDecWithPrec(1, 1), // 10% + DappLiquidationThreshold: 100_000_000_000, // default 100’000 KEX + DappLiquidationPeriod: 2419200, // default 2419200, ~28d MintingFtFee: 100_000_000_000_000, MintingNftFee: 100_000_000_000_000, - VetoThreshold: sdk.NewDecWithPrec(3340, 2), // 33.40% + VetoThreshold: sdk.NewDecWithPrec(3340, 4), // 33.40% AutocompoundIntervalNumBlocks: 17280, + DowntimeInactiveDuration: 600, }, ExecutionFees: []types.ExecutionFee{ { @@ -457,45 +462,45 @@ func TestExportInitGenesis(t *testing.T) { }, "network_actors": [], "network_properties": { - "min_tx_fee": "100", - "max_tx_fee": "1000000", - "vote_quorum": "33", - "minimum_proposal_end_time": "300", - "proposal_enactment_time": "300", - "min_proposal_end_blocks": "2", - "min_proposal_enactment_blocks": "1", - "enable_foreign_fee_payments": true, - "mischance_rank_decrease_amount": "1", - "max_mischance": "1", - "mischance_confidence": "0", - "inactive_rank_decrease_percent": "0.020000000000000000", - "min_validators": "1", - "poor_network_max_bank_send": "1", - "unjail_max_time": "0", - "enable_token_whitelist": false, - "enable_token_blacklist": false, - "min_identity_approval_tip": "200", - "unique_identity_keys": "moniker,username", - "ubi_hardcap": "6000000", - "validators_fee_share": "0.500000000000000000", - "inflation_rate": "0.180000000000000000", - "inflation_period": "31557600", - "unstaking_period": "2629800", - "max_delegators": "100", - "min_delegation_pushout": "10", - "slashing_period": "3600", - "max_jailed_percentage": "0.250000000000000000", - "max_slashing_percentage": "0.010000000000000000", - "min_custody_reward": "200", - "max_custody_buffer_size": "10", - "max_custody_tx_size": "8192", - "abstention_rank_decrease_amount": "1", - "max_abstention": "2", - "min_collective_bond": "100000", - "min_collective_bonding_time": "86400", - "max_collective_outputs": "10", - "min_collective_claim_period": "14400", - "validator_recovery_bond": "300000", + "min_tx_fee": "100", + "max_tx_fee": "1000000", + "vote_quorum": "0.330000000000000000", + "minimum_proposal_end_time": "300", + "proposal_enactment_time": "300", + "min_proposal_end_blocks": "2", + "min_proposal_enactment_blocks": "1", + "enable_foreign_fee_payments": true, + "mischance_rank_decrease_amount": "1", + "max_mischance": "1", + "mischance_confidence": "0", + "inactive_rank_decrease_percent": "0.020000000000000000", + "min_validators": "1", + "poor_network_max_bank_send": "1", + "unjail_max_time": "600", + "enable_token_whitelist": false, + "enable_token_blacklist": false, + "min_identity_approval_tip": "200", + "unique_identity_keys": "moniker,username", + "ubi_hardcap": "6000000", + "validators_fee_share": "0.500000000000000000", + "inflation_rate": "0.180000000000000000", + "inflation_period": "31557600", + "unstaking_period": "2629800", + "max_delegators": "100", + "min_delegation_pushout": "10", + "slashing_period": "2629800", + "max_jailed_percentage": "0.250000000000000000", + "max_slashing_percentage": "0.005000000000000000", + "min_custody_reward": "200", + "max_custody_buffer_size": "10", + "max_custody_tx_size": "8192", + "abstention_rank_decrease_amount": "1", + "max_abstention": "2", + "min_collective_bond": "100000", + "min_collective_bonding_time": "86400", + "max_collective_outputs": "10", + "min_collective_claim_period": "14400", + "validator_recovery_bond": "300000", "max_annual_inflation": "0.350000000000000000", "max_proposal_title_size": "128", "max_proposal_description_size": "1024", @@ -503,21 +508,22 @@ func TestExportInitGenesis(t *testing.T) { "max_proposal_poll_option_count": "128", "max_proposal_reference_size": "512", "max_proposal_checksum_size": "128", - "min_dapp_bond": "1000000", + "min_dapp_bond": "1000000", "max_dapp_bond": "10000000", - "dapp_liquidation_threshold": "0", - "dapp_liquidation_period": "0", + "dapp_liquidation_threshold": "100000000000", + "dapp_liquidation_period": "2419200", "dapp_bond_duration": "604800", "dapp_verifier_bond": "0.001000000000000000", "dapp_auto_denounce_time": "60", "dapp_mischance_rank_decrease_amount": "1", "dapp_max_mischance": "10", - "dapp_inactive_rank_decrease_percent": "10", + "dapp_inactive_rank_decrease_percent": "0.100000000000000000", "dapp_pool_slippage_default": "0.100000000000000000", "minting_ft_fee": "100000000000000", "minting_nft_fee": "100000000000000", - "veto_threshold": "33.400000000000000000", - "autocompound_interval_num_blocks": "17280" + "veto_threshold": "0.334000000000000000", + "autocompound_interval_num_blocks": "17280", + "downtime_inactive_duration": "600" }, "execution_fees": [ { diff --git a/x/gov/handler_test.go b/x/gov/handler_test.go index 50eb6452d..07260a934 100644 --- a/x/gov/handler_test.go +++ b/x/gov/handler_test.go @@ -264,6 +264,10 @@ func TestNewHandler_SetNetworkProperties(t *testing.T) { sudoAddr, err := sdk.AccAddressFromBech32("kira1alzyfq40zjsveat87jlg8jxetwqmr0a29sgd0f") require.NoError(t, err) + networkProperties := types.DefaultGenesis().NetworkProperties + networkProperties.MinTxFee = 100 + networkProperties.MaxTxFee = 1000 + tests := []struct { name string msg sdk.Msg @@ -272,22 +276,16 @@ func TestNewHandler_SetNetworkProperties(t *testing.T) { { name: "Success run with ChangeTxFee permission", msg: &types.MsgSetNetworkProperties{ - NetworkProperties: &types.NetworkProperties{ - MinTxFee: 100, - MaxTxFee: 1000, - }, - Proposer: changeFeeAddr, + NetworkProperties: networkProperties, + Proposer: changeFeeAddr, }, desiredErr: "", }, { name: "Failure run without ChangeTxFee permission", msg: &types.MsgSetNetworkProperties{ - NetworkProperties: &types.NetworkProperties{ - MinTxFee: 100, - MaxTxFee: 1000, - }, - Proposer: sudoAddr, + NetworkProperties: networkProperties, + Proposer: sudoAddr, }, desiredErr: "not enough permissions", }, diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 43ae874db..0b92d491c 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -9,11 +9,11 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" appparams "github.com/KiraCore/sekai/app/params" kiratypes "github.com/KiraCore/sekai/types" "github.com/KiraCore/sekai/x/gov/types" stakingtypes "github.com/KiraCore/sekai/x/staking/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" ) @@ -162,7 +162,7 @@ func (k Keeper) ExecutionFee(goCtx context.Context, request *types.ExecutionFeeR ctx := sdk.UnwrapSDKContext(goCtx) fee := k.GetExecutionFee(ctx, request.TransactionType) if fee == nil { - return nil, sdkerrors.Wrap(types.ErrFeeNotExist, fmt.Sprintf("fee does not exist for %s", request.TransactionType)) + return nil, errorsmod.Wrap(types.ErrFeeNotExist, fmt.Sprintf("fee does not exist for %s", request.TransactionType)) } return &types.ExecutionFeeResponse{Fee: fee}, nil } @@ -195,7 +195,7 @@ func (k Keeper) Proposal(goCtx context.Context, request *types.QueryProposalRequ ctx := sdk.UnwrapSDKContext(goCtx) proposal, found := k.GetProposal(ctx, request.ProposalId) if found == false { - return nil, sdkerrors.Wrap(types.ErrGettingProposals, fmt.Sprintf("proposal does not exist for %d", request.ProposalId)) + return nil, errorsmod.Wrap(types.ErrGettingProposals, fmt.Sprintf("proposal does not exist for %d", request.ProposalId)) } votes := k.GetProposalVotes(ctx, request.ProposalId) return &types.QueryProposalResponse{ @@ -209,7 +209,7 @@ func (k Keeper) Proposals(goCtx context.Context, request *types.QueryProposalsRe c := sdk.UnwrapSDKContext(goCtx) if request == nil { err := status.Error(codes.InvalidArgument, "empty request") - return nil, sdkerrors.Wrap(types.ErrGettingProposals, fmt.Sprintf("error getting proposals: %s", err.Error())) + return nil, errorsmod.Wrap(types.ErrGettingProposals, fmt.Sprintf("error getting proposals: %s", err.Error())) } store := c.KVStore(k.storeKey) @@ -251,7 +251,7 @@ func (k Keeper) Proposals(goCtx context.Context, request *types.QueryProposalsRe pageRes, err = query.FilteredPaginate(proposalsStore, request.Pagination, onResult) if err != nil { - return nil, sdkerrors.Wrap(types.ErrGettingProposals, fmt.Sprintf("error getting proposals: %s", err.Error())) + return nil, errorsmod.Wrap(types.ErrGettingProposals, fmt.Sprintf("error getting proposals: %s", err.Error())) } res := types.QueryProposalsResponse{ @@ -267,7 +267,7 @@ func (k Keeper) WhitelistedProposalVoters(goCtx context.Context, request *types. ctx := sdk.UnwrapSDKContext(goCtx) proposal, found := k.GetProposal(ctx, request.ProposalId) if !found { - return nil, sdkerrors.Wrap(types.ErrGettingProposals, fmt.Sprintf("proposal does not exist for %d", request.ProposalId)) + return nil, errorsmod.Wrap(types.ErrGettingProposals, fmt.Sprintf("proposal does not exist for %d", request.ProposalId)) } // dynamic proposal users for spending pool proposals @@ -385,7 +385,7 @@ func (k Keeper) Vote(goCtx context.Context, request *types.QueryVoteRequest) (*t } vote, found := k.GetVote(ctx, request.ProposalId, voter) if !found { - return &types.QueryVoteResponse{Vote: vote}, sdkerrors.Wrap(types.ErrGettingProposalVotes, fmt.Sprintf("error getting votes for proposal %d, voter %s", request.ProposalId, request.Voter)) + return &types.QueryVoteResponse{Vote: vote}, errorsmod.Wrap(types.ErrGettingProposalVotes, fmt.Sprintf("error getting votes for proposal %d, voter %s", request.ProposalId, request.Voter)) } return &types.QueryVoteResponse{Vote: vote}, nil } diff --git a/x/gov/keeper/identity_registrar.go b/x/gov/keeper/identity_registrar.go index 355729159..71a8c07b1 100644 --- a/x/gov/keeper/identity_registrar.go +++ b/x/gov/keeper/identity_registrar.go @@ -8,11 +8,11 @@ import ( "strings" "time" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/gov/types" stakingtypes "github.com/KiraCore/sekai/x/staking/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func ValidateIdentityRecordKey(key string) bool { @@ -144,6 +144,32 @@ func (k Keeper) DeleteIdentityRecordById(ctx sdk.Context, recordId uint64) { prefix.NewStore(ctx.KVStore(k.storeKey), types.IdentityRecordByAddressPrefix(record.Address)).Delete(sdk.Uint64ToBigEndian(recordId)) } +func (k Keeper) CancelInvalidIdentityRecordVerifyRequests(ctx sdk.Context, address sdk.AccAddress, recordIds []uint64) error { + recordIdMap := make(map[uint64]bool) + for _, recordId := range recordIds { + recordIdMap[recordId] = true + } + // if record value's updated after requesting verification, cancels verification request automatically + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.IdRecordVerifyRequestByRequesterPrefix(address.String())) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + requestId := sdk.BigEndianToUint64(iterator.Value()) + request := k.GetIdRecordsVerifyRequest(ctx, requestId) + for _, reqRecordId := range request.RecordIds { + if recordIdMap[reqRecordId] { + err := k.CancelIdentityRecordsVerifyRequest(ctx, address, requestId) + if err != nil { + return err + } + break + } + } + } + return nil +} + // RegisterIdentityRecord defines a method to register identity records for an address func (k Keeper) RegisterIdentityRecords(ctx sdk.Context, address sdk.AccAddress, infos []types.IdentityInfoEntry) error { // validate key and set the key to non case-sensitive @@ -151,7 +177,7 @@ func (k Keeper) RegisterIdentityRecords(ctx sdk.Context, address sdk.AccAddress, uniqueKeys := strings.Split(properties.UniqueIdentityKeys, ",") for i, info := range infos { if !ValidateIdentityRecordKey(info.Key) { - return sdkerrors.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", info.Key)) + return errorsmod.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", info.Key)) } infos[i].Key = FormalizeIdentityRecordKey(info.Key) @@ -182,17 +208,21 @@ func (k Keeper) RegisterIdentityRecords(ctx sdk.Context, address sdk.AccAddress, if len(addrs) == 1 && bytes.Equal(addrs[0], address) { } else if len(addrs) > 0 { - return sdkerrors.Wrap(types.ErrKeyShouldBeUnique, fmt.Sprintf("the key %s, value %s is already registered by %s", infos[i].Key, infos[i].Info, addrs[0].String())) + return errorsmod.Wrap(types.ErrKeyShouldBeUnique, fmt.Sprintf("the key %s, value %s is already registered by %s", infos[i].Key, infos[i].Info, addrs[0].String())) } } } + recordIdsAffected := []uint64{} for _, info := range infos { // use existing record id if it already exists recordId := k.GetIdentityRecordIdByAddressKey(ctx, address, info.Key) + record := k.GetIdentityRecordById(ctx, recordId) if recordId == 0 { recordId = k.GetLastIdentityRecordId(ctx) + 1 k.SetLastIdentityRecordId(ctx, recordId) + } else if record == nil || record.Value != info.Info { + recordIdsAffected = append(recordIdsAffected, recordId) } // create or update identity record k.SetIdentityRecord(ctx, types.IdentityRecord{ @@ -204,7 +234,7 @@ func (k Keeper) RegisterIdentityRecords(ctx sdk.Context, address sdk.AccAddress, Verifiers: []string{}, }) } - return nil + return k.CancelInvalidIdentityRecordVerifyRequests(ctx, address, recordIdsAffected) } // DeleteIdentityRecords defines a method to delete identity records owned by an address @@ -212,13 +242,13 @@ func (k Keeper) DeleteIdentityRecords(ctx sdk.Context, address sdk.AccAddress, k // validate key and set the key to non case-sensitive for i, key := range keys { if !ValidateIdentityRecordKey(key) { - return sdkerrors.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", key)) + return errorsmod.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", key)) } keys[i] = FormalizeIdentityRecordKey(key) // we prevent deleting moniker field of a validator if key == "moniker" { - return sdkerrors.Wrap(types.ErrMonikerDeletionNotAllowed, fmt.Sprintf("moniker field is not allowed to delete")) + return errorsmod.Wrap(types.ErrMonikerDeletionNotAllowed, fmt.Sprintf("moniker field is not allowed to delete")) } } @@ -246,34 +276,14 @@ func (k Keeper) DeleteIdentityRecords(ctx sdk.Context, address sdk.AccAddress, k for _, recordId := range recordIds { prevRecord := k.GetIdentityRecordById(ctx, recordId) if prevRecord == nil { - return sdkerrors.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) + return errorsmod.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) } recordIdMap[recordId] = true k.DeleteIdentityRecordById(ctx, recordId) } - // remove record ids from verification request list - requests := k.GetIdRecordsVerifyRequestsByRequester(ctx, address) - for _, request := range requests { - recordIds := []uint64{} - for _, recordid := range request.RecordIds { - if !recordIdMap[recordid] { - recordIds = append(recordIds, recordid) - } - } - - if len(recordIds) == 0 { - err := k.CancelIdentityRecordsVerifyRequest(ctx, sdk.MustAccAddressFromBech32(request.Address), request.Id) - if err != nil { - return err - } - } else { - request.RecordIds = recordIds - k.SetIdentityRecordsVerifyRequest(ctx, request) - } - } - return nil + return k.CancelInvalidIdentityRecordVerifyRequests(ctx, address, recordIds) } // GetAllIdentityRecords query all identity records @@ -297,7 +307,7 @@ func (k Keeper) GetIdRecordsByAddressAndKeys(ctx sdk.Context, address sdk.AccAdd // validate key and set the key to non case-sensitive for i, key := range keys { if !ValidateIdentityRecordKey(key) { - return []types.IdentityRecord{}, sdkerrors.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", key)) + return []types.IdentityRecord{}, errorsmod.Wrap(types.ErrInvalidIdentityRecordKey, fmt.Sprintf("invalid key exists: key=%s", key)) } keys[i] = FormalizeIdentityRecordKey(key) } @@ -393,7 +403,7 @@ func (k Keeper) RequestIdentityRecordsVerify(ctx sdk.Context, address, verifier for _, recordId := range recordIds { if !idsMap[recordId] { - return requestId, sdkerrors.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("executor is not owner of the identity record: id=%d", recordId)) + return requestId, errorsmod.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("executor is not owner of the identity record: id=%d", recordId)) } } @@ -401,7 +411,7 @@ func (k Keeper) RequestIdentityRecordsVerify(ctx sdk.Context, address, verifier for _, recordId := range recordIds { record := k.GetIdentityRecordById(ctx, recordId) if record == nil { - return requestId, sdkerrors.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) + return requestId, errorsmod.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) } if lastRecordEditDate.Before(record.Date) { lastRecordEditDate = record.Date @@ -419,7 +429,7 @@ func (k Keeper) RequestIdentityRecordsVerify(ctx sdk.Context, address, verifier minApprovalTip := k.GetNetworkProperties(ctx).MinIdentityApprovalTip if sdk.NewInt(int64(minApprovalTip)).GT(tip.Amount) { - return requestId, sdkerrors.Wrap(types.ErrInvalidApprovalTip, fmt.Sprintf("approval tip is lower than minimum tip configured by the network")) + return requestId, errorsmod.Wrap(types.ErrInvalidApprovalTip, fmt.Sprintf("approval tip is lower than minimum tip configured by the network")) } k.SetIdentityRecordsVerifyRequest(ctx, request) @@ -467,7 +477,7 @@ func (k Keeper) DeleteIdRecordsVerifyRequest(ctx sdk.Context, requestId uint64) func (k Keeper) HandleIdentityRecordsVerifyRequest(ctx sdk.Context, verifier sdk.AccAddress, requestId uint64, approve bool) error { request := k.GetIdRecordsVerifyRequest(ctx, requestId) if request == nil { - return sdkerrors.Wrap(types.ErrInvalidVerifyRequestId, fmt.Sprintf("specified identity record verify request does NOT exist: id=%d", requestId)) + return errorsmod.Wrap(types.ErrInvalidVerifyRequestId, fmt.Sprintf("specified identity record verify request does NOT exist: id=%d", requestId)) } if verifier.String() != request.Verifier { return errors.New("verifier does not match with requested") @@ -484,7 +494,7 @@ func (k Keeper) HandleIdentityRecordsVerifyRequest(ctx sdk.Context, verifier sdk for _, recordId := range request.RecordIds { record := k.GetIdentityRecordById(ctx, recordId) if record == nil { - return sdkerrors.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) + return errorsmod.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) } if record.Date.After(request.LastRecordEditDate) { @@ -501,7 +511,7 @@ func (k Keeper) HandleIdentityRecordsVerifyRequest(ctx sdk.Context, verifier sdk for _, recordId := range request.RecordIds { record := k.GetIdentityRecordById(ctx, recordId) if record == nil { - return sdkerrors.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) + return errorsmod.Wrap(types.ErrInvalidIdentityRecordId, fmt.Sprintf("identity record with specified id does NOT exist: id=%d", recordId)) } // if already exist, skip @@ -520,7 +530,7 @@ func (k Keeper) HandleIdentityRecordsVerifyRequest(ctx sdk.Context, verifier sdk func (k Keeper) CancelIdentityRecordsVerifyRequest(ctx sdk.Context, executor sdk.AccAddress, requestId uint64) error { request := k.GetIdRecordsVerifyRequest(ctx, requestId) if request == nil { - return sdkerrors.Wrap(types.ErrInvalidVerifyRequestId, fmt.Sprintf("specified identity record verify request does NOT exist: id=%d", requestId)) + return errorsmod.Wrap(types.ErrInvalidVerifyRequestId, fmt.Sprintf("specified identity record verify request does NOT exist: id=%d", requestId)) } if executor.String() != request.Address { return errors.New("executor is not identity record creator") diff --git a/x/gov/keeper/identity_registrar_test.go b/x/gov/keeper/identity_registrar_test.go index 9192b7ffe..27a7cc5b6 100644 --- a/x/gov/keeper/identity_registrar_test.go +++ b/x/gov/keeper/identity_registrar_test.go @@ -202,7 +202,7 @@ func TestKeeper_IdentityRecordAddEditRemove(t *testing.T) { records = app.CustomGovKeeper.GetAllIdentityRecords(ctx) require.Len(t, records, 2) records = app.CustomGovKeeper.GetIdRecordsByAddress(ctx, addr1) - require.NotNil(t, record) + require.NotNil(t, records) records = app.CustomGovKeeper.GetIdRecordsByAddress(ctx, addr2) require.Len(t, records, 0) @@ -267,12 +267,12 @@ func TestKeeper_TryUniqueIdentityKeysSet(t *testing.T) { // create a new record and check if set correctly now := time.Now().UTC() ctx = ctx.WithBlockTime(now) - err := app.CustomGovKeeper.SetNetworkProperty(ctx, types.UniqueIdentityKeys, types.NetworkPropertyValue{StrValue: "moniker,email"}) + err := app.CustomGovKeeper.SetNetworkProperty(ctx, types.UniqueIdentityKeys, types.NetworkPropertyValue{StrValue: "moniker,username,email"}) require.NoError(t, err) networkProperties := app.CustomGovKeeper.GetNetworkProperties(ctx) require.NotNil(t, networkProperties) - require.Equal(t, networkProperties.UniqueIdentityKeys, "moniker,email") + require.Equal(t, networkProperties.UniqueIdentityKeys, "moniker,username,email") } // func TestKeeper_IdentityKeysManagement(t *testing.T) { @@ -566,6 +566,7 @@ func TestKeeper_IdentityRecordApproveFlow(t *testing.T) { // try deleting request after request creation reqId, err = app.CustomGovKeeper.RequestIdentityRecordsVerify(ctx, addr2, addr3, []uint64{2}, sdk.NewInt64Coin(appparams.DefaultDenom, 200)) + require.NoError(t, err) require.Equal(t, reqId, uint64(7)) app.CustomGovKeeper.DeleteIdRecordsVerifyRequest(ctx, 7) request = app.CustomGovKeeper.GetIdRecordsVerifyRequest(ctx, 7) @@ -575,22 +576,20 @@ func TestKeeper_IdentityRecordApproveFlow(t *testing.T) { requests = app.CustomGovKeeper.GetIdRecordsVerifyRequestsByApprover(ctx, addr3) require.Len(t, requests, 0) - // check automatic reject if record is edited after raising verification request + // check automatic cancel of request if record is edited after raising verification request reqId, err = app.CustomGovKeeper.RequestIdentityRecordsVerify(ctx, addr2, addr4, []uint64{2}, sdk.NewInt64Coin(appparams.DefaultDenom, 200)) + require.NoError(t, err) require.Equal(t, reqId, uint64(8)) ctx = ctx.WithBlockTime(now.Add(time.Second)) - app.CustomGovKeeper.RegisterIdentityRecords(ctx, addr2, types.WrapInfos(infos)) - ctx, _ = ctx.CacheContext() - err = app.CustomGovKeeper.HandleIdentityRecordsVerifyRequest(ctx, addr4, 8, true) + infos["key"] = "value2" + err = app.CustomGovKeeper.RegisterIdentityRecords(ctx, addr2, types.WrapInfos(infos)) require.NoError(t, err) - record = app.CustomGovKeeper.GetIdentityRecordById(ctx, 2) - require.NotNil(t, record) - require.False(t, keeper.CheckIfWithinStringArray(addr4.String(), record.Verifiers)) - coins = app.BankKeeper.GetAllBalances(ctx, addr4) - require.Equal(t, coins, sdk.Coins{sdk.NewInt64Coin(appparams.DefaultDenom, 200)}) + req := app.CustomGovKeeper.GetIdRecordsVerifyRequest(ctx, 8) + require.Nil(t, req) // try deleting id record after request creation reqId, err = app.CustomGovKeeper.RequestIdentityRecordsVerify(ctx, addr2, addr3, []uint64{2}, sdk.NewInt64Coin(appparams.DefaultDenom, 200)) + require.NoError(t, err) require.Equal(t, reqId, uint64(9)) app.CustomGovKeeper.DeleteIdentityRecords(ctx, addr2, []string{}) cacheCtx, _ = ctx.CacheContext() diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 0df38b799..d4bb86dd4 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "errors" "fmt" + "strings" "github.com/KiraCore/sekai/x/gov/types" "github.com/cosmos/cosmos-sdk/codec" @@ -66,46 +67,66 @@ func (k Keeper) ValidateNetworkProperties(ctx sdk.Context, properties *types.Net if properties.MaxTxFee < properties.MinTxFee { return fmt.Errorf("max_tx_fee should not be lower than min_tx_fee") } - // TODO: for now skipping few of validations - // if properties.VoteQuorum == 0 { - // return fmt.Errorf("vote_quorum should not be zero") - // } - // if properties.ProposalEndTime == 0 { - // return fmt.Errorf("proposal_end_time should not be zero") - // } - // if properties.ProposalEnactmentTime == 0 { - // return fmt.Errorf("proposal_enactment_time should not be zero") - // } - // if properties.MinProposalEndBlocks == 0 { - // return fmt.Errorf("min_proposal_end_blocks should not be zero") - // } - // if properties.MinProposalEnactmentBlocks == 0 { - // return fmt.Errorf("min_proposal_enactment_blocks should not be zero") - // } - // if properties.MischanceRankDecreaseAmount == 0 { - // return fmt.Errorf("mischance_rank_decrease_amount should not be zero") - // } - // if properties.MaxMischance == 0 { - // return fmt.Errorf("max_mischance should not be zero") - // } - // if properties.InactiveRankDecreasePercent == 0 { - // return fmt.Errorf("inactive_rank_decrease_percent should not be zero") - // } - // if properties.InactiveRankDecreasePercent == 0 { - // return fmt.Errorf("inactive_rank_decrease_percent should not be zero") - // } - if !properties.InactiveRankDecreasePercent.IsNil() && properties.InactiveRankDecreasePercent.GT(sdk.OneDec()) { - return fmt.Errorf("inactive_rank_decrease_percent should not be lower than 100%%") + if properties.VoteQuorum.IsNil() || properties.VoteQuorum.IsNegative() || properties.VoteQuorum.GT(sdk.OneDec()) { + return fmt.Errorf("vote_quorum should be between 0-1") + } + if properties.VetoThreshold.IsNil() || properties.VetoThreshold.IsNegative() || properties.VetoThreshold.GT(sdk.OneDec()) { + return fmt.Errorf("veto_threshold should be between 0-1") + } + if properties.MinimumProposalEndTime == 0 { + return fmt.Errorf("minimum_proposal_end_time should not be zero") + } + if properties.ProposalEnactmentTime == 0 { + return fmt.Errorf("proposal_enactment_time should not be zero") + } + if properties.MinProposalEndBlocks == 0 { + return fmt.Errorf("min_proposal_end_blocks should not be zero") + } + if properties.MinProposalEnactmentBlocks == 0 { + return fmt.Errorf("min_proposal_enactment_blocks should not be zero") + } + if properties.MischanceRankDecreaseAmount == 0 { + return fmt.Errorf("mischance_rank_decrease_amount should not be zero") + } + if properties.MaxMischance == 0 { + return fmt.Errorf("max_mischance should not be zero") + } + if properties.InactiveRankDecreasePercent.IsNil() || properties.InactiveRankDecreasePercent.IsNegative() || properties.InactiveRankDecreasePercent.GT(sdk.OneDec()) { + return fmt.Errorf("inactive_rank_decrease_percent should be between 0-1") + } + if properties.ValidatorsFeeShare.IsNil() || properties.ValidatorsFeeShare.IsNegative() || properties.ValidatorsFeeShare.GT(sdk.NewDecWithPrec(5, 1)) { + return fmt.Errorf("validators_fee_share should be between 0-0.5") + } + if properties.InflationRate.IsNil() || properties.InflationRate.IsNegative() || properties.InflationRate.GT(sdk.NewDecWithPrec(5, 1)) { + return fmt.Errorf("inflation_rate should be between 0-0.5") + } + if properties.MaxJailedPercentage.IsNil() || properties.MaxJailedPercentage.IsNegative() || properties.MaxJailedPercentage.GT(sdk.OneDec()) { + return fmt.Errorf("max_jailed_percentage should be between 0-1") + } + if properties.MaxSlashingPercentage.IsNil() || properties.MaxSlashingPercentage.IsNegative() || properties.MaxSlashingPercentage.GT(sdk.OneDec()) { + return fmt.Errorf("max_slashing_percentage should be between 0-1") + } + if properties.MaxAnnualInflation.IsNil() || properties.MaxAnnualInflation.IsNegative() { + return fmt.Errorf("max_slashing_percentage should not be negative") + } + if properties.DappVerifierBond.IsNil() || properties.DappVerifierBond.IsNegative() || properties.DappVerifierBond.GT(sdk.OneDec()) { + return fmt.Errorf("dapp_verifier_bond should be between 0-1") + } + if properties.DappPoolSlippageDefault.IsNil() || properties.DappPoolSlippageDefault.IsNegative() || properties.DappPoolSlippageDefault.GT(sdk.OneDec()) { + return fmt.Errorf("dapp_pool_slippage_default should be between 0-1") + } + if properties.DappInactiveRankDecreasePercent.IsNil() || properties.DappInactiveRankDecreasePercent.IsNegative() || properties.DappInactiveRankDecreasePercent.GT(sdk.OneDec()) { + return fmt.Errorf("dapp_inactive_rank_decrease_percent should be between 0-1") + } + if properties.MinValidators == 0 { + return fmt.Errorf("min_validators should not be zero") + } + if properties.PoorNetworkMaxBankSend == 0 { + return fmt.Errorf("poor_network_bank_send should not be zero") + } + if properties.UnjailMaxTime == 0 { + return fmt.Errorf("unjail_max_time should not be zero") } - // if properties.MinValidators == 0 { - // return fmt.Errorf("min_validators should not be zero") - // } - // if properties.PoorNetworkMaxBankSend == 0 { - // return fmt.Errorf("min_validators should not be zero") - // } - // if properties.UnjailMaxTime == 0 { - // return fmt.Errorf("unjail_max_time should not be zero") - // } // fee := k.GetExecutionFee(ctx, (&types.MsgHandleIdentityRecordsVerifyRequest{}).Type()) // maxFee := properties.MinTxFee // if fee != nil { @@ -119,25 +140,44 @@ func (k Keeper) ValidateNetworkProperties(ctx sdk.Context, properties *types.Net // if properties.MinIdentityApprovalTip < maxFee*2 { // return fmt.Errorf("min_identity_approval_tip should not be bigger or equal than 2x approval fee") // } - // if properties.UniqueIdentityKeys == "" { - // return fmt.Errorf("unique_identity_keys should not be empty") - // } - // monikerExists := false - // if properties.UniqueIdentityKeys != FormalizeIdentityRecordKey(properties.UniqueIdentityKeys) { - // return fmt.Errorf("unique identity keys on network property should be formailzed with lowercase keys") - // } - // uniqueKeys := strings.Split(properties.UniqueIdentityKeys, ",") - // for _, key := range uniqueKeys { - // if !ValidateIdentityRecordKey(key) { - // return fmt.Errorf("invalid identity record key exists, key=%s", key) - // } - // if key == "moniker" { - // monikerExists = true - // } - // } - // if !monikerExists { - // return fmt.Errorf("moniker should be exist in unique keys list") - // } + if properties.UniqueIdentityKeys == "" { + return fmt.Errorf("unique_identity_keys should not be empty") + } + monikerExists := false + if properties.UniqueIdentityKeys != FormalizeIdentityRecordKey(properties.UniqueIdentityKeys) { + return fmt.Errorf("unique identity keys on network property should be formailzed with lowercase keys") + } + uniqueKeys := strings.Split(properties.UniqueIdentityKeys, ",") + for _, key := range uniqueKeys { + if !ValidateIdentityRecordKey(key) { + return fmt.Errorf("invalid identity record key exists, key=%s", key) + } + if key == "moniker" { + monikerExists = true + } + } + if !monikerExists { + return fmt.Errorf("moniker should be exist in unique keys list") + } + if properties.InflationPeriod < 2629800 || properties.InflationPeriod > 31557600 { + return fmt.Errorf("inflation_period should be between 2629800 and 31557600") + } + if properties.UnstakingPeriod < 604800 || properties.UnstakingPeriod > 31557600 { + return fmt.Errorf("unstaking_period should be between 604800 and 31557600") + } + if properties.UnstakingPeriod > properties.SlashingPeriod { + return fmt.Errorf("unstaking_period should be lower than slashing_period") + } + if properties.SlashingPeriod <= 0 { + return fmt.Errorf("slashing_period should be positive") + } + if properties.MaxJailedPercentage.GTE(sdk.OneDec().QuoInt64(3)) { + return fmt.Errorf("max_jailed_percentage should be less than 1/3") + } + if properties.UnjailMaxTime > properties.SlashingPeriod { + return fmt.Errorf("unjail_max_time should be strictly less than slashing_period") + } + return nil } @@ -150,7 +190,7 @@ func (k Keeper) GetNetworkProperty(ctx sdk.Context, property types.NetworkProper case types.MaxTxFee: return types.NetworkPropertyValue{Value: properties.MaxTxFee}, nil case types.VoteQuorum: - return types.NetworkPropertyValue{Value: properties.VoteQuorum}, nil + return types.NetworkPropertyValue{StrValue: properties.VoteQuorum.String()}, nil case types.MinimumProposalEndTime: return types.NetworkPropertyValue{Value: properties.MinimumProposalEndTime}, nil case types.ProposalEnactmentTime: @@ -240,7 +280,7 @@ func (k Keeper) GetNetworkProperty(ctx sdk.Context, property types.NetworkProper case types.DappMaxMischance: return types.NetworkPropertyValue{Value: properties.DappMaxMischance}, nil case types.DappInactiveRankDecreasePercent: - return types.NetworkPropertyValue{Value: properties.DappInactiveRankDecreasePercent}, nil + return types.NetworkPropertyValue{StrValue: properties.DappInactiveRankDecreasePercent.String()}, nil case types.DappPoolSlippageDefault: return types.NetworkPropertyValue{StrValue: properties.DappPoolSlippageDefault.String()}, nil case types.MintingFtFee: @@ -251,11 +291,71 @@ func (k Keeper) GetNetworkProperty(ctx sdk.Context, property types.NetworkProper return types.NetworkPropertyValue{StrValue: properties.VetoThreshold.String()}, nil case types.AutocompoundIntervalNumBlocks: return types.NetworkPropertyValue{Value: properties.AutocompoundIntervalNumBlocks}, nil + case types.DowntimeInactiveDuration: + return types.NetworkPropertyValue{Value: properties.DowntimeInactiveDuration}, nil default: return types.NetworkPropertyValue{}, errors.New("trying to fetch network property that does not exist") } } +func (k Keeper) EnsureOldUniqueKeysNotRemoved(ctx sdk.Context, oldKeys string, newKeys string) string { + newKeyMap := make(map[string]bool) + newKeyArr := strings.Split(newKeys, ",") + if newKeys == "" { + newKeyArr = []string{} + } + for _, newKey := range newKeyArr { + newKeyMap[newKey] = true + } + + oldKeyArr := strings.Split(oldKeys, ",") + if oldKeys == "" { + oldKeyArr = []string{} + } + for _, oldKey := range oldKeyArr { + if !newKeyMap[oldKey] { + return oldKey + } + } + return "" +} + +func (k Keeper) EnsureUniqueKeys(ctx sdk.Context, oldKeys string, newKeys string) string { + oldKeyMap := make(map[string]bool) + oldKeyArr := strings.Split(oldKeys, ",") + if oldKeys == "" { + oldKeyArr = []string{} + } + for _, oldKey := range oldKeyArr { + oldKeyMap[oldKey] = true + } + + newKeyMap := make(map[string]bool) + newKeyArr := strings.Split(newKeys, ",") + if newKeys == "" { + newKeyArr = []string{} + } + for _, newKey := range newKeyArr { + if !oldKeyMap[newKey] { + newKeyMap[newKey] = true + } + } + + keyCountMap := make(map[string]int64) + records := k.GetAllIdentityRecords(ctx) + for _, record := range records { + if newKeyMap[record.Key] { + key := strings.Join([]string{record.Key, record.Value}, ":") + if keyCountMap[key] > 0 { + return record.Key + } + keyCountMap[key] = 1 + } + } + + return "" +} + // SetNetworkProperty set single network property by key func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProperty, value types.NetworkPropertyValue) error { properties := k.GetNetworkProperties(ctx) @@ -265,7 +365,11 @@ func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProper case types.MaxTxFee: properties.MaxTxFee = value.Value case types.VoteQuorum: - properties.VoteQuorum = value.Value + decValue, err := sdk.NewDecFromStr(value.StrValue) + if err != nil { + return err + } + properties.VoteQuorum = decValue case types.MinimumProposalEndTime: properties.MinimumProposalEndTime = value.Value case types.ProposalEnactmentTime: @@ -304,6 +408,14 @@ func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProper case types.MinIdentityApprovalTip: properties.MinIdentityApprovalTip = value.Value case types.UniqueIdentityKeys: + removedOldKey := k.EnsureOldUniqueKeysNotRemoved(ctx, properties.UniqueIdentityKeys, value.StrValue) + if removedOldKey != "" { + return fmt.Errorf("already existing key removed: %s", removedOldKey) + } + notUniqueKey := k.EnsureUniqueKeys(ctx, properties.UniqueIdentityKeys, value.StrValue) + if notUniqueKey != "" { + return fmt.Errorf("already existing key not unique found: %s", notUniqueKey) + } properties.UniqueIdentityKeys = value.StrValue case types.UbiHardcap: properties.UbiHardcap = value.Value @@ -386,7 +498,11 @@ func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProper case types.DappMaxMischance: properties.DappMaxMischance = value.Value case types.DappInactiveRankDecreasePercent: - properties.DappInactiveRankDecreasePercent = value.Value + decValue, err := sdk.NewDecFromStr(value.StrValue) + if err != nil { + return err + } + properties.DappInactiveRankDecreasePercent = decValue case types.DappPoolSlippageDefault: decValue, err := sdk.NewDecFromStr(value.StrValue) if err != nil { @@ -403,9 +519,10 @@ func (k Keeper) SetNetworkProperty(ctx sdk.Context, property types.NetworkProper return err } properties.VetoThreshold = decValue - case types.AutocompoundIntervalNumBlocks: properties.AutocompoundIntervalNumBlocks = value.Value + case types.DowntimeInactiveDuration: + properties.DowntimeInactiveDuration = value.Value default: return errors.New("trying to set network property that does not exist") } diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index fb3729043..ce8c68a2a 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -26,3 +26,36 @@ func TestKeeper_SetNetworkProperty(t *testing.T) { require.Nil(t, err) require.Equal(t, uint64(300), savedMinTxFee.Value) } + +func TestKeeper_EnsureUniqueKeys(t *testing.T) { + app := simapp.Setup(false) + ctx := app.NewContext(false, tmproto.Header{}) + + app.CustomGovKeeper.SetIdentityRecord(ctx, types.IdentityRecord{ + Id: 1, + Address: "addr1", + Key: "nickname", + Value: "jack", + }) + notUniqueKey := app.CustomGovKeeper.EnsureUniqueKeys(ctx, "", "nickname") + require.Equal(t, notUniqueKey, "") + app.CustomGovKeeper.SetIdentityRecord(ctx, types.IdentityRecord{ + Id: 2, + Address: "addr2", + Key: "nickname", + Value: "jack", + }) + notUniqueKey = app.CustomGovKeeper.EnsureUniqueKeys(ctx, "", "nickname") + require.Equal(t, notUniqueKey, "nickname") +} + +func TestKeeper_EnsureOldUniqueKeysNotRemoved(t *testing.T) { + app := simapp.Setup(false) + ctx := app.NewContext(false, tmproto.Header{}) + + removedOldKey := app.CustomGovKeeper.EnsureOldUniqueKeysNotRemoved(ctx, "", "nickname") + require.Equal(t, removedOldKey, "") + + removedOldKey = app.CustomGovKeeper.EnsureOldUniqueKeysNotRemoved(ctx, "nickname", "") + require.Equal(t, removedOldKey, "nickname") +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 64af059e7..9ed13c0b5 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -7,10 +7,10 @@ import ( "strconv" "time" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/exp/utf8string" ) @@ -806,17 +806,17 @@ func (k msgServer) CouncilorPause( // cannot be paused if not jailed already if councilor.Status == types.CouncilorJailed { - return nil, sdkerrors.Wrap(types.ErrCouncilorJailed, "Can NOT pause jailed councilor") + return nil, errorsmod.Wrap(types.ErrCouncilorJailed, "Can NOT pause jailed councilor") } // cannot be paused if not inactive already if councilor.Status == types.CouncilorInactive { - return nil, sdkerrors.Wrap(types.ErrCouncilorInactivated, "Can NOT pause inactivated councilor") + return nil, errorsmod.Wrap(types.ErrCouncilorInactivated, "Can NOT pause inactivated councilor") } // cannot be paused if not paused already if councilor.Status == types.CouncilorPaused { - return nil, sdkerrors.Wrap(types.ErrCouncilorPaused, "Can NOT pause already paused councilor") + return nil, errorsmod.Wrap(types.ErrCouncilorPaused, "Can NOT pause already paused councilor") } councilor.Status = types.CouncilorPaused @@ -843,7 +843,7 @@ func (k msgServer) CouncilorUnpause( // cannot be paused if not paused already if councilor.Status != types.CouncilorPaused { - return nil, sdkerrors.Wrap(types.ErrCouncilorNotPaused, "Can NOT unpause not paused councilor") + return nil, errorsmod.Wrap(types.ErrCouncilorNotPaused, "Can NOT unpause not paused councilor") } councilor.Status = types.CouncilorActive @@ -871,7 +871,7 @@ func (k msgServer) CouncilorActivate( // cannot be activated if not inactive already if councilor.Status != types.CouncilorInactive { - return nil, sdkerrors.Wrap(types.ErrCouncilorNotInactivated, "Can NOT activate NOT inactive councilor") + return nil, errorsmod.Wrap(types.ErrCouncilorNotInactivated, "Can NOT activate NOT inactive councilor") } councilor.Status = types.CouncilorActive diff --git a/x/gov/proposal_handler.go b/x/gov/proposal_handler.go index 1e32d0e27..7b2f8f225 100644 --- a/x/gov/proposal_handler.go +++ b/x/gov/proposal_handler.go @@ -3,6 +3,7 @@ package gov import ( "fmt" + errorsmod "cosmossdk.io/errors" kiratypes "github.com/KiraCore/sekai/types" "github.com/KiraCore/sekai/x/gov/keeper" "github.com/KiraCore/sekai/x/gov/types" @@ -29,7 +30,7 @@ func (a ApplyWhitelistAccountPermissionProposalHandler) Apply(ctx sdk.Context, p actor, found := a.keeper.GetNetworkActorByAddress(ctx, p.Address) if found { if actor.Permissions.IsWhitelisted(types.PermValue(p.Permission)) { - return sdkerrors.Wrap(types.ErrWhitelisting, "permission already whitelisted") + return errorsmod.Wrap(types.ErrWhitelisting, "permission already whitelisted") } } else { actor = types.NewDefaultActor(p.Address) @@ -56,7 +57,7 @@ func (a ApplyBlacklistAccountPermissionProposalHandler) Apply(ctx sdk.Context, p actor, found := a.keeper.GetNetworkActorByAddress(ctx, p.Address) if found { if actor.Permissions.IsBlacklisted(types.PermValue(p.Permission)) { - return sdkerrors.Wrap(types.ErrWhitelisting, "permission already blacklisted") + return errorsmod.Wrap(types.ErrWhitelisting, "permission already blacklisted") } } else { actor = types.NewDefaultActor(p.Address) @@ -83,7 +84,7 @@ func (a ApplyRemoveWhitelistedAccountPermissionProposalHandler) Apply(ctx sdk.Co actor, found := a.keeper.GetNetworkActorByAddress(ctx, p.Address) if found { if !actor.Permissions.IsWhitelisted(types.PermValue(p.Permission)) { - return sdkerrors.Wrap(types.ErrWhitelisting, "whitelisted permission does not exist") + return errorsmod.Wrap(types.ErrWhitelisting, "whitelisted permission does not exist") } } else { actor = types.NewDefaultActor(p.Address) @@ -111,7 +112,7 @@ func (a ApplyRemoveBlacklistedAccountPermissionProposalHandler) Apply(ctx sdk.Co fmt.Println("actor", actor) if found { if !actor.Permissions.IsBlacklisted(types.PermValue(p.Permission)) { - return sdkerrors.Wrap(types.ErrWhitelisting, "blacklisted permission does not exist") + return errorsmod.Wrap(types.ErrWhitelisting, "blacklisted permission does not exist") } } else { actor = types.NewDefaultActor(p.Address) @@ -184,10 +185,10 @@ func (a ApplySetNetworkPropertyProposalHandler) Apply(ctx sdk.Context, proposalI property, err := a.keeper.GetNetworkProperty(ctx, p.NetworkProperty) if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } if property == p.Value { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "network property already set as proposed value") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "network property already set as proposed value") } return a.keeper.SetNetworkProperty(ctx, p.NetworkProperty, p.Value) diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 4f37824c7..1d5ce8893 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -105,9 +105,9 @@ func DefaultGenesis() *GenesisState { NetworkProperties: &NetworkProperties{ MinTxFee: 100, MaxTxFee: 1000000, - VoteQuorum: 33, - MinimumProposalEndTime: 300, // 300 seconds / 5 mins - ProposalEnactmentTime: 300, // 300 seconds / 5 mins + VoteQuorum: sdk.NewDecWithPrec(33, 2), // 33% + MinimumProposalEndTime: 300, // 300 seconds / 5 mins + ProposalEnactmentTime: 300, // 300 seconds / 5 mins MinProposalEndBlocks: 2, MinProposalEnactmentBlocks: 1, EnableForeignFeePayments: true, @@ -129,9 +129,9 @@ func DefaultGenesis() *GenesisState { UnstakingPeriod: 2629800, // 1 month MaxDelegators: 100, MinDelegationPushout: 10, - SlashingPeriod: 3600, + SlashingPeriod: 2629800, MaxJailedPercentage: sdk.NewDecWithPrec(25, 2), - MaxSlashingPercentage: sdk.NewDecWithPrec(1, 2), + MaxSlashingPercentage: sdk.NewDecWithPrec(5, 3), // 0.5% MinCustodyReward: 200, MaxCustodyTxSize: 8192, MaxCustodyBufferSize: 10, @@ -156,12 +156,15 @@ func DefaultGenesis() *GenesisState { DappAutoDenounceTime: 60, // 60s DappMischanceRankDecreaseAmount: 1, DappMaxMischance: 10, - DappInactiveRankDecreasePercent: 10, - DappPoolSlippageDefault: sdk.NewDecWithPrec(1, 1), // 10% + DappInactiveRankDecreasePercent: sdk.NewDecWithPrec(10, 2), // 10% + DappPoolSlippageDefault: sdk.NewDecWithPrec(1, 1), // 10% + DappLiquidationThreshold: 100_000_000_000, // default 100’000 KEX + DappLiquidationPeriod: 2419200, // default 2419200, ~28d MintingFtFee: 100_000_000_000_000, MintingNftFee: 100_000_000_000_000, - VetoThreshold: sdk.NewDecWithPrec(3340, 2), // 33.40% + VetoThreshold: sdk.NewDecWithPrec(3340, 4), // 33.40% AutocompoundIntervalNumBlocks: 17280, + DowntimeInactiveDuration: 600, }, ExecutionFees: []ExecutionFee{ { diff --git a/x/gov/types/msg.go b/x/gov/types/msg.go index 3febb36b9..249bccef6 100644 --- a/x/gov/types/msg.go +++ b/x/gov/types/msg.go @@ -3,6 +3,7 @@ package types import ( "fmt" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -635,6 +636,7 @@ func (m *MsgVoteProposal) GetSigners() []sdk.AccAddress { } // NewMsgPollCreate creates a new MsgPollCreate. +// //nolint:interfacer func NewMsgPollCreate(creator sdk.AccAddress, title, description string, reference string, checksum string, pollValues []string, roles []string, valueCount uint64, valueType string, possibleChoices uint64, duration string) *MsgPollCreate { m := &MsgPollCreate{ @@ -667,7 +669,7 @@ func (m MsgPollCreate) Type() string { return types.MsgTypeCreatePoll } // ValidateBasic implements Msg func (m MsgPollCreate) ValidateBasic() error { if m.Creator.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Creator.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, m.Creator.String()) } return nil @@ -902,6 +904,7 @@ func (m *MsgCancelIdentityRecordsVerifyRequest) GetSigners() []sdk.AccAddress { } // NewMsgSubmitProposal creates a new MsgSubmitProposal. +// //nolint:interfacer func NewMsgSubmitProposal(proposer sdk.AccAddress, title, description string, content Content) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ @@ -950,12 +953,12 @@ func (m MsgSubmitProposal) Type() string { return types.MsgTypeSubmitProposal } // ValidateBasic implements Msg func (m MsgSubmitProposal) ValidateBasic() error { if m.Proposer.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer.String()) } content := m.GetContent() if content == nil { - return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") + return errorsmod.Wrap(ErrInvalidProposalContent, "missing content") } if err := content.ValidateBasic(); err != nil { return err diff --git a/x/gov/types/network_properties.pb.go b/x/gov/types/network_properties.pb.go index 022585a2a..d63aeea2c 100644 --- a/x/gov/types/network_properties.pb.go +++ b/x/gov/types/network_properties.pb.go @@ -88,6 +88,7 @@ const ( MintingNftFee NetworkProperty = 58 VetoThreshold NetworkProperty = 59 AutocompoundIntervalNumBlocks NetworkProperty = 60 + DowntimeInactiveDuration NetworkProperty = 61 ) var NetworkProperty_name = map[int32]string{ @@ -152,6 +153,7 @@ var NetworkProperty_name = map[int32]string{ 58: "MINTING_NFT_FEE", 59: "VETO_THRESHOLD", 60: "AUTOCOMPOUND_INTERVAL_NUM_BLOCKS", + 61: "DOWNTIME_INACTIVE_DURATION", } var NetworkProperty_value = map[string]int32{ @@ -216,6 +218,7 @@ var NetworkProperty_value = map[string]int32{ "MINTING_NFT_FEE": 58, "VETO_THRESHOLD": 59, "AUTOCOMPOUND_INTERVAL_NUM_BLOCKS": 60, + "DOWNTIME_INACTIVE_DURATION": 61, } func (x NetworkProperty) String() string { @@ -333,7 +336,7 @@ func (m *NetworkPropertyValue) GetStrValue() string { type NetworkProperties struct { MinTxFee uint64 `protobuf:"varint,1,opt,name=min_tx_fee,json=minTxFee,proto3" json:"min_tx_fee,omitempty"` MaxTxFee uint64 `protobuf:"varint,2,opt,name=max_tx_fee,json=maxTxFee,proto3" json:"max_tx_fee,omitempty"` - VoteQuorum uint64 `protobuf:"varint,3,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` MinimumProposalEndTime uint64 `protobuf:"varint,4,opt,name=minimum_proposal_end_time,json=minimumProposalEndTime,proto3" json:"minimum_proposal_end_time,omitempty"` ProposalEnactmentTime uint64 `protobuf:"varint,5,opt,name=proposal_enactment_time,json=proposalEnactmentTime,proto3" json:"proposal_enactment_time,omitempty"` MinProposalEndBlocks uint64 `protobuf:"varint,6,opt,name=min_proposal_end_blocks,json=minProposalEndBlocks,proto3" json:"min_proposal_end_blocks,omitempty"` @@ -386,12 +389,13 @@ type NetworkProperties struct { DappAutoDenounceTime uint64 `protobuf:"varint,53,opt,name=dapp_auto_denounce_time,json=dappAutoDenounceTime,proto3" json:"dapp_auto_denounce_time,omitempty"` DappMischanceRankDecreaseAmount uint64 `protobuf:"varint,54,opt,name=dapp_mischance_rank_decrease_amount,json=dappMischanceRankDecreaseAmount,proto3" json:"dapp_mischance_rank_decrease_amount,omitempty"` DappMaxMischance uint64 `protobuf:"varint,55,opt,name=dapp_max_mischance,json=dappMaxMischance,proto3" json:"dapp_max_mischance,omitempty"` - DappInactiveRankDecreasePercent uint64 `protobuf:"varint,56,opt,name=dapp_inactive_rank_decrease_percent,json=dappInactiveRankDecreasePercent,proto3" json:"dapp_inactive_rank_decrease_percent,omitempty"` + DappInactiveRankDecreasePercent github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,56,opt,name=dapp_inactive_rank_decrease_percent,json=dappInactiveRankDecreasePercent,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dapp_inactive_rank_decrease_percent"` DappPoolSlippageDefault github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,57,opt,name=dapp_pool_slippage_default,json=dappPoolSlippageDefault,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"dapp_pool_slippage_default"` MintingFtFee uint64 `protobuf:"varint,58,opt,name=minting_ft_fee,json=mintingFtFee,proto3" json:"minting_ft_fee,omitempty"` MintingNftFee uint64 `protobuf:"varint,59,opt,name=minting_nft_fee,json=mintingNftFee,proto3" json:"minting_nft_fee,omitempty"` VetoThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,60,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"veto_threshold"` AutocompoundIntervalNumBlocks uint64 `protobuf:"varint,61,opt,name=autocompound_interval_num_blocks,json=autocompoundIntervalNumBlocks,proto3" json:"autocompound_interval_num_blocks,omitempty"` + DowntimeInactiveDuration uint64 `protobuf:"varint,62,opt,name=downtime_inactive_duration,json=downtimeInactiveDuration,proto3" json:"downtime_inactive_duration,omitempty"` } func (m *NetworkProperties) Reset() { *m = NetworkProperties{} } @@ -441,13 +445,6 @@ func (m *NetworkProperties) GetMaxTxFee() uint64 { return 0 } -func (m *NetworkProperties) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *NetworkProperties) GetMinimumProposalEndTime() uint64 { if m != nil { return m.MinimumProposalEndTime @@ -763,13 +760,6 @@ func (m *NetworkProperties) GetDappMaxMischance() uint64 { return 0 } -func (m *NetworkProperties) GetDappInactiveRankDecreasePercent() uint64 { - if m != nil { - return m.DappInactiveRankDecreasePercent - } - return 0 -} - func (m *NetworkProperties) GetMintingFtFee() uint64 { if m != nil { return m.MintingFtFee @@ -791,6 +781,13 @@ func (m *NetworkProperties) GetAutocompoundIntervalNumBlocks() uint64 { return 0 } +func (m *NetworkProperties) GetDowntimeInactiveDuration() uint64 { + if m != nil { + return m.DowntimeInactiveDuration + } + return 0 +} + func init() { proto.RegisterEnum("kira.gov.NetworkProperty", NetworkProperty_name, NetworkProperty_value) proto.RegisterType((*MsgSetNetworkProperties)(nil), "kira.gov.MsgSetNetworkProperties") @@ -801,184 +798,187 @@ func init() { func init() { proto.RegisterFile("kira/gov/network_properties.proto", fileDescriptor_98011a6048e5dde3) } var fileDescriptor_98011a6048e5dde3 = []byte{ - // 2825 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x59, 0xdb, 0x72, 0xdb, 0x46, - 0xb6, 0xb5, 0x12, 0x27, 0x91, 0xdb, 0xb6, 0x04, 0x43, 0xb4, 0x05, 0x43, 0x36, 0x05, 0xdb, 0xb1, - 0xe3, 0x24, 0xb6, 0x64, 0x3b, 0xb1, 0x93, 0xd8, 0x49, 0x9d, 0x03, 0x12, 0xa0, 0x85, 0x88, 0xb8, - 0x18, 0x17, 0x3a, 0x4e, 0x9d, 0xaa, 0x0e, 0x44, 0xb6, 0x24, 0x1c, 0x92, 0x00, 0x83, 0x8b, 0x42, - 0xe5, 0x0b, 0x4e, 0xf1, 0xe9, 0xfc, 0x00, 0xab, 0xa6, 0x6a, 0x7e, 0x61, 0x6a, 0xbe, 0x21, 0x8f, - 0x79, 0x9c, 0x9a, 0x87, 0xd4, 0x54, 0xf2, 0x32, 0xdf, 0x30, 0x4f, 0x53, 0x7d, 0x01, 0xc0, 0x9b, - 0xe4, 0x29, 0x3d, 0x59, 0xee, 0xbd, 0xd6, 0xee, 0xdd, 0xbb, 0x57, 0x37, 0x7a, 0x15, 0xc1, 0xad, - 0x6e, 0x10, 0xfb, 0xdb, 0x07, 0xd1, 0xd1, 0x76, 0x88, 0xd2, 0x9f, 0xa2, 0xb8, 0x0b, 0x07, 0x71, - 0x34, 0x40, 0x71, 0x1a, 0xa0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 0x95, 0xce, 0x41, 0x87, 0x75, 0x7f, 0x48, 0x54, 0xf5, 0x39, 0xb8, - 0xc6, 0xf6, 0x36, 0x8d, 0xba, 0x28, 0x84, 0x3f, 0x1d, 0x06, 0x29, 0xea, 0x05, 0x49, 0x2a, 0x70, - 0x64, 0x5b, 0x2b, 0x34, 0xea, 0xe2, 0xe0, 0xeb, 0x3c, 0x36, 0xc7, 0xda, 0xeb, 0xf9, 0xed, 0x2e, - 0x61, 0x5d, 0x99, 0x63, 0xd5, 0xf2, 0x18, 0x3b, 0x34, 0x10, 0x77, 0x3e, 0x0d, 0xd2, 0x63, 0xe8, - 0x0f, 0x06, 0x71, 0x74, 0xe4, 0xf7, 0x60, 0x1a, 0x0c, 0x04, 0xbe, 0x38, 0x34, 0x1a, 0x8b, 0xcb, - 0x2c, 0xec, 0x06, 0x03, 0xfe, 0x11, 0xa8, 0x64, 0x61, 0xf0, 0x63, 0x86, 0x4a, 0x76, 0x17, 0x1d, - 0x27, 0xc2, 0x1a, 0xb9, 0x10, 0x78, 0x1a, 0xcb, 0x89, 0xbb, 0xe8, 0x38, 0xc1, 0x47, 0x38, 0xdb, - 0x0b, 0xe0, 0xa1, 0x1f, 0x77, 0xda, 0xfe, 0x40, 0xa8, 0xd0, 0x23, 0x9c, 0xed, 0x05, 0x3b, 0x74, - 0x84, 0xff, 0x01, 0x54, 0xca, 0x0d, 0x20, 0x8a, 0x4e, 0x0e, 0xfd, 0x18, 0x09, 0x57, 0xcf, 0xb4, - 0xdf, 0x7c, 0x99, 0xab, 0x81, 0x90, 0x83, 0x33, 0xf1, 0x1e, 0x58, 0x09, 0xc2, 0xfd, 0x9e, 0x9f, - 0x06, 0x51, 0x08, 0x63, 0x3f, 0x45, 0xc2, 0xb5, 0x33, 0xe5, 0xbe, 0x5c, 0x64, 0xb1, 0xfd, 0x14, - 0xf1, 0x1f, 0x03, 0xae, 0x4c, 0x3b, 0x40, 0x71, 0x10, 0x75, 0x84, 0x75, 0xb2, 0xbc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, 0xfe, 0xcd, 0x77, 0x71, 0x90, 0x48, - 0x04, 0x3f, 0x18, 0x26, 0x69, 0x1d, 0x94, 0xb4, 0xe3, 0x60, 0x40, 0x04, 0x43, 0xc8, 0x9f, 0xb0, - 0x07, 0x43, 0x49, 0x56, 0x4a, 0x08, 0x49, 0xf1, 0xdf, 0x33, 0x29, 0x06, 0x51, 0xaf, 0x07, 0xa3, - 0x89, 0x14, 0x9f, 0x92, 0x14, 0xd7, 0x27, 0x52, 0x58, 0x51, 0xaf, 0x67, 0x96, 0x19, 0x6a, 0xa0, - 0x7a, 0x62, 0x86, 0x36, 0x91, 0xe9, 0x83, 0xb9, 0x2a, 0xca, 0x14, 0x75, 0x22, 0x52, 0xbc, 0xb1, - 0x93, 0x39, 0x62, 0xb4, 0x8f, 0x62, 0xfc, 0xd1, 0xa7, 0x35, 0x3c, 0x64, 0x1b, 0x5b, 0x26, 0xb0, - 0x73, 0x00, 0x29, 0xe1, 0x05, 0x10, 0xa7, 0xe8, 0xed, 0x43, 0xd4, 0xee, 0x26, 0x59, 0x9f, 0xb2, - 0xb7, 0x08, 0x7b, 0x7d, 0x82, 0x5d, 0x67, 0x71, 0x42, 0xbe, 0x0d, 0x2e, 0x93, 0x6b, 0xd2, 0x1f, - 0x0c, 0xa8, 0x16, 0xb6, 0x09, 0xfe, 0x22, 0xbe, 0x1d, 0xfd, 0xc1, 0x80, 0x28, 0xe0, 0x36, 0x7d, - 0xd2, 0x94, 0x98, 0x47, 0x0c, 0xe3, 0x0f, 0x0b, 0xcc, 0xd7, 0x40, 0x24, 0xf1, 0x5e, 0xf0, 0x63, - 0x86, 0x45, 0x84, 0xd7, 0x9f, 0x1e, 0xc6, 0x28, 0x39, 0x8c, 0x7a, 0x1d, 0xe1, 0x31, 0x5d, 0x02, - 0x46, 0x34, 0x4b, 0x80, 0x9b, 0xc7, 0xb1, 0x36, 0xe7, 0xd8, 0x4c, 0xd6, 0x4f, 0xa8, 0x36, 0x67, - 0xa8, 0x4c, 0xd3, 0x0f, 0x00, 0x5f, 0x54, 0x05, 0x3b, 0x59, 0x4c, 0x95, 0xf9, 0x19, 0xbd, 0x53, - 0x3a, 0xac, 0x36, 0x85, 0x8d, 0xf3, 0xff, 0xc3, 0xd0, 0x47, 0x28, 0x0e, 0xf6, 0x03, 0x14, 0xd3, - 0xc5, 0x7c, 0x7e, 0x26, 0x1d, 0x93, 0xec, 0x2d, 0x96, 0x88, 0x74, 0xe0, 0x29, 0x5b, 0x83, 0x9f, - 0xa5, 0x11, 0xec, 0xa0, 0x30, 0xca, 0xf0, 0x0e, 0x92, 0xfb, 0xe0, 0x29, 0x55, 0x31, 0x0e, 0xcb, - 0x59, 0x1a, 0x29, 0x2c, 0x48, 0xee, 0x82, 0x26, 0xb8, 0x43, 0x68, 0x6f, 0x79, 0x79, 0x3e, 0x23, - 0x29, 0x36, 0x31, 0x54, 0x3f, 0xe5, 0xf5, 0x99, 0x37, 0x64, 0xfa, 0x09, 0xfa, 0x45, 0xd9, 0x10, - 0x7d, 0xf2, 0x19, 0x9a, 0xcf, 0xfd, 0x96, 0x87, 0xe5, 0x97, 0xe5, 0xdc, 0xda, 0x29, 0x8f, 0xc5, - 0x2e, 0x93, 0xc0, 0x20, 0x8a, 0x7a, 0x30, 0xe9, 0x05, 0x83, 0x81, 0x7f, 0x80, 0x60, 0x07, 0xed, - 0xfb, 0x59, 0x2f, 0x15, 0xbe, 0x3a, 0x53, 0x9b, 0x49, 0x4b, 0xad, 0x28, 0xea, 0x39, 0x2c, 0x9f, - 0x42, 0xd3, 0xf1, 0x1f, 0x92, 0x97, 0x69, 0x8a, 0xaf, 0xdc, 0xfd, 0x94, 0x58, 0xa3, 0xe7, 0xec, - 0x9d, 0x4d, 0x47, 0x1b, 0x29, 0xb6, 0x47, 0xf7, 0xc0, 0x6a, 0x8e, 0x0a, 0x19, 0xec, 0x45, 0xf1, - 0x80, 0xc5, 0xc3, 0xc6, 0x3e, 0xc1, 0x79, 0x60, 0xe5, 0x08, 0xa5, 0xd1, 0x84, 0x62, 0xbf, 0x3e, - 0xdb, 0x03, 0x08, 0x67, 0x29, 0x65, 0xfd, 0x12, 0x48, 0x58, 0x0d, 0xed, 0xa8, 0x3f, 0x88, 0xb2, - 0xb0, 0x03, 0x83, 0x30, 0x45, 0x31, 0x7e, 0x47, 0x86, 0x59, 0x3f, 0x77, 0x35, 0xdf, 0x90, 0x7a, - 0x6e, 0x4e, 0xe2, 0x34, 0x06, 0x33, 0xb2, 0x3e, 0x35, 0x36, 0x9f, 0x8c, 0xae, 0x83, 0xd5, 0x19, - 0x2b, 0x8a, 0x8d, 0xa1, 0xae, 0x19, 0xd0, 0xfd, 0x0e, 0x36, 0x54, 0x95, 0x3b, 0x27, 0x5e, 0x1a, - 0x8d, 0xa5, 0x65, 0x7d, 0xc2, 0x36, 0xea, 0xf2, 0x77, 0x79, 0x74, 0x89, 0x45, 0x27, 0x6c, 0x63, - 0xcb, 0x74, 0x55, 0xf8, 0xca, 0x33, 0x6d, 0x4f, 0xe7, 0xde, 0x11, 0x57, 0x46, 0x63, 0x09, 0xb4, - 0xa6, 0x6c, 0xa3, 0xae, 0x19, 0x9a, 0xee, 0xe9, 0xd0, 0xb2, 0x4d, 0xcb, 0x74, 0xe4, 0x26, 0x54, - 0x0d, 0x05, 0xba, 0x9a, 0xae, 0x72, 0xef, 0x8a, 0xe2, 0x68, 0x2c, 0x5d, 0xd3, 0x4f, 0xb4, 0x8d, - 0x13, 0x14, 0xb9, 0xee, 0xea, 0xaa, 0xe1, 0x52, 0xe2, 0x79, 0xf1, 0xfa, 0x68, 0x2c, 0x5d, 0xb5, - 0x4e, 0xb2, 0x8d, 0x78, 0x3d, 0x53, 0xd3, 0xd5, 0x9a, 0x66, 0x7d, 0xd7, 0xe1, 0xde, 0x13, 0x85, - 0xd1, 0x58, 0xaa, 0xe8, 0x27, 0xd8, 0xc6, 0x19, 0x5a, 0x3e, 0x25, 0x23, 0xbf, 0x2f, 0x56, 0x47, - 0x63, 0x49, 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xf6, 0xce, 0x9b, - 0xb1, 0x2d, 0x39, 0xca, 0x60, 0xb0, 0xe7, 0xc5, 0xa3, 0x69, 0xc2, 0xb6, 0xdc, 0x05, 0x2b, 0x2d, - 0xd5, 0x35, 0x27, 0x14, 0xf5, 0x82, 0xc2, 0x5a, 0xb3, 0x36, 0x04, 0xef, 0x56, 0xdd, 0xd4, 0x2d, - 0xd3, 0x33, 0x14, 0xa8, 0x19, 0xae, 0x6a, 0xe3, 0x77, 0x8c, 0xe1, 0xe9, 0xf9, 0x2b, 0xf9, 0x6b, - 0xf1, 0xd6, 0x68, 0x2c, 0xdd, 0x94, 0x4f, 0xb3, 0x21, 0xe2, 0xf9, 0xff, 0xfb, 0x73, 0xf5, 0x5c, - 0xed, 0xbf, 0x7e, 0xf9, 0xbd, 0xba, 0xf4, 0xeb, 0xef, 0xd5, 0xa5, 0x7f, 0xfc, 0x5e, 0x5d, 0xfa, - 0xff, 0x3f, 0xaa, 0xe7, 0x7e, 0xfd, 0xa3, 0x7a, 0xee, 0x6f, 0x7f, 0x54, 0xcf, 0x7d, 0x7f, 0x77, - 0xc2, 0x26, 0xed, 0x06, 0xb1, 0x5f, 0x8f, 0x62, 0xb4, 0x9d, 0xa0, 0xae, 0x1f, 0x6c, 0x0f, 0xc9, - 0x2f, 0x88, 0xc4, 0x29, 0xed, 0xbd, 0x4f, 0x7e, 0x15, 0xfc, 0xec, 0xdf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x06, 0xee, 0x6e, 0x01, 0x5a, 0x1c, 0x00, 0x00, + // 2874 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x59, 0xdd, 0x72, 0xd4, 0x56, + 0xb6, 0xc6, 0x09, 0x49, 0xcc, 0x36, 0xd8, 0x42, 0x6e, 0xb0, 0x90, 0xc1, 0x16, 0x10, 0x08, 0x49, + 0xc0, 0x06, 0x12, 0x48, 0x02, 0x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, 0x96, 0x1b, 0x74, 0x11, 0xff, 0x14, 0xac, 0x8d, 0x50, 0xfc, 0x66, 0xda, 0x45, + 0x61, 0x4a, 0x89, 0xef, 0x11, 0xe2, 0x95, 0x5e, 0xc1, 0x60, 0x56, 0xc2, 0x7b, 0x02, 0xd6, 0xf0, + 0xfe, 0xc7, 0xc2, 0xed, 0x77, 0xa2, 0x66, 0x3b, 0x11, 0xde, 0x27, 0xbc, 0x4a, 0x37, 0x08, 0x47, + 0x82, 0x55, 0x89, 0x8d, 0x97, 0xc1, 0x8d, 0x09, 0x5a, 0x1e, 0x92, 0x91, 0x3f, 0x20, 0x64, 0x71, + 0x8c, 0xcc, 0x20, 0xcc, 0xc5, 0x37, 0x60, 0x1d, 0x85, 0xfe, 0x7e, 0x07, 0xc1, 0x83, 0x28, 0x46, + 0xc1, 0x61, 0x88, 0x6b, 0x0c, 0x7b, 0xfe, 0x09, 0xc6, 0x24, 0xc2, 0xa2, 0xb4, 0x70, 0x6f, 0xd1, + 0x16, 0x28, 0xa4, 0x4e, 0x11, 0x75, 0x84, 0x2c, 0x66, 0xe7, 0x6b, 0x60, 0xa3, 0x1b, 0x24, 0xcd, + 0x23, 0x3f, 0x6c, 0x22, 0x18, 0xfb, 0x61, 0x1b, 0xb6, 0x50, 0x33, 0x46, 0x7e, 0x82, 0xa0, 0xdf, + 0x8d, 0xb2, 0x30, 0x15, 0x2e, 0x90, 0x14, 0xd6, 0x0b, 0x94, 0xed, 0x87, 0x6d, 0x85, 0x61, 0x64, + 0x02, 0xe1, 0x6f, 0x83, 0x4b, 0xb8, 0xbf, 0x05, 0x44, 0x00, 0x84, 0x73, 0xb1, 0xeb, 0xf7, 0xf5, + 0x7c, 0x8d, 0x7f, 0x04, 0x2a, 0x65, 0xa4, 0x66, 0x14, 0x1e, 0x04, 0x2d, 0x84, 0xb1, 0x4b, 0x04, + 0xbb, 0x5a, 0xd8, 0x6a, 0x85, 0x89, 0x4f, 0xc0, 0x46, 0x80, 0xb7, 0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 0xad, 0xba, 0x66, 0x40, 0xf7, 0x3b, 0x58, 0x57, 0x55, 0xee, 0x9c, 0x78, 0x71, 0x30, 0x94, + 0x16, 0xf5, 0x11, 0x51, 0xab, 0xcb, 0xdf, 0xe5, 0xd6, 0x05, 0x66, 0xcd, 0x45, 0xed, 0x26, 0x58, + 0xda, 0x33, 0x5d, 0x15, 0xbe, 0xf4, 0x4c, 0xdb, 0xd3, 0xb9, 0x77, 0xc4, 0xe5, 0xc1, 0x50, 0x02, + 0x7b, 0x63, 0x22, 0x55, 0xd7, 0x0c, 0x4d, 0xf7, 0x74, 0x68, 0xd9, 0xa6, 0x65, 0x3a, 0x72, 0x03, + 0xaa, 0x86, 0x02, 0x5d, 0x4d, 0x57, 0xb9, 0x77, 0x45, 0x71, 0x30, 0x94, 0xae, 0xea, 0x73, 0x45, + 0xea, 0x08, 0x45, 0xae, 0xb9, 0xba, 0x6a, 0xb8, 0x94, 0x78, 0x5e, 0xbc, 0x36, 0x18, 0x4a, 0x57, + 0xac, 0x79, 0x22, 0x15, 0xef, 0x67, 0x2c, 0x5c, 0xb5, 0x61, 0xd6, 0x76, 0x1d, 0xee, 0x3d, 0x51, + 0x18, 0x0c, 0xa5, 0x8a, 0x3e, 0x47, 0xa4, 0x4e, 0xd0, 0xf2, 0x90, 0x8c, 0xfc, 0xbe, 0xb8, 0x31, + 0x18, 0x4a, 0xa2, 0x7e, 0xaa, 0x48, 0x55, 0x0d, 0xb9, 0xda, 0x50, 0x61, 0xdd, 0xb4, 0x55, 0xed, + 0x85, 0x81, 0x6b, 0x06, 0x2d, 0xf9, 0x35, 0x76, 0xe3, 0x70, 0x1f, 0x88, 0xd7, 0x07, 0x43, 0x49, + 0x50, 0x4f, 0x11, 0xa9, 0xba, 0xe6, 0xd4, 0x76, 0x64, 0xa3, 0xa6, 0x42, 0x5b, 0x36, 0x76, 0xa1, + 0xa2, 0xd6, 0x6c, 0x55, 0x76, 0x54, 0x28, 0xeb, 0xa6, 0x67, 0xb8,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0d, 0x73, 0x46, 0x03, 0xe4, 0xac, 0xeb, + 0xf4, 0x02, 0xd3, 0xe7, 0x89, 0x36, 0xbc, 0x95, 0x9a, 0xe7, 0xb8, 0xa6, 0xf2, 0x1a, 0xda, 0xea, + 0x2b, 0xd9, 0x56, 0xb8, 0x1b, 0x62, 0x65, 0x30, 0x94, 0x38, 0x7d, 0x86, 0x68, 0xc3, 0x51, 0x72, + 0x74, 0xd5, 0xab, 0xd7, 0x55, 0x1b, 0x3a, 0xda, 0xf7, 0x2a, 0xb7, 0xc1, 0x76, 0x3e, 0x47, 0xb4, + 0x8d, 0xd2, 0xdc, 0xef, 0x28, 0x65, 0x93, 0x45, 0x99, 0x21, 0xda, 0xe4, 0xaa, 0xe3, 0xe2, 0x11, + 0x24, 0x33, 0x30, 0xe3, 0x72, 0x92, 0x44, 0x69, 0x30, 0x94, 0xae, 0xcb, 0x6f, 0x11, 0x6d, 0x38, + 0x6a, 0xe9, 0x8a, 0xbb, 0x59, 0x34, 0x73, 0x5c, 0xb4, 0x91, 0x0a, 0x98, 0x8d, 0x86, 0x4a, 0xaf, + 0x9c, 0xaa, 0x69, 0x28, 0xdc, 0x2d, 0xf1, 0xca, 0x60, 0x28, 0x5d, 0xd6, 0x67, 0x89, 0xb6, 0x19, + 0x78, 0x5c, 0x73, 0x72, 0x01, 0xdc, 0xa6, 0x17, 0xaf, 0x7e, 0x8a, 0x68, 0x23, 0xb5, 0x28, 0xe9, + 0xa6, 0xe7, 0x5a, 0x9e, 0xeb, 0x70, 0x1f, 0x96, 0x15, 0x9c, 0x25, 0xda, 0x26, 0x82, 0xd6, 0x1a, + 0xb2, 0xa6, 0xe7, 0x73, 0x74, 0x67, 0x46, 0xd0, 0x09, 0xd1, 0x56, 0x1c, 0x43, 0x68, 0xab, 0x35, + 0x73, 0x4f, 0xb5, 0x5f, 0xd3, 0x7d, 0xde, 0xa5, 0xd3, 0xb1, 0x37, 0x53, 0xb4, 0x3d, 0x04, 0x15, + 0x52, 0x42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d, 0x2e, + 0x8b, 0x59, 0xcc, 0xd7, 0x37, 0x6c, 0x9a, 0xe7, 0x88, 0x18, 0xf1, 0xfc, 0x1f, 0xfe, 0xbc, 0x71, + 0xae, 0xfa, 0xdf, 0x3f, 0xff, 0xb6, 0xb1, 0xf0, 0xcb, 0x6f, 0x1b, 0x0b, 0xff, 0xf8, 0x6d, 0x63, + 0xe1, 0x8f, 0xbf, 0x6f, 0x9c, 0xfb, 0xe5, 0xf7, 0x8d, 0x73, 0x7f, 0xfb, 0x7d, 0xe3, 0xdc, 0xf7, + 0x77, 0x46, 0x24, 0xda, 0x6e, 0x10, 0xfb, 0xb5, 0x28, 0x46, 0xdb, 0x09, 0x6a, 0xfb, 0xc1, 0x76, + 0x9f, 0xfc, 0x3a, 0x4a, 0x54, 0xda, 0xfe, 0xfb, 0xe4, 0x17, 0xcf, 0xcf, 0xfe, 0x1d, 0x00, 0x00, + 0xff, 0xff, 0x68, 0x66, 0xa7, 0x7c, 0x36, 0x1d, 0x00, 0x00, } func (this *NetworkPropertyValue) Equal(that interface{}) bool { @@ -1105,6 +1105,13 @@ func (m *NetworkProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DowntimeInactiveDuration != 0 { + i = encodeVarintNetworkProperties(dAtA, i, uint64(m.DowntimeInactiveDuration)) + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xf0 + } if m.AutocompoundIntervalNumBlocks != 0 { i = encodeVarintNetworkProperties(dAtA, i, uint64(m.AutocompoundIntervalNumBlocks)) i-- @@ -1150,13 +1157,18 @@ func (m *NetworkProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3 i-- dAtA[i] = 0xca - if m.DappInactiveRankDecreasePercent != 0 { - i = encodeVarintNetworkProperties(dAtA, i, uint64(m.DappInactiveRankDecreasePercent)) - i-- - dAtA[i] = 0x3 - i-- - dAtA[i] = 0xc0 + { + size := m.DappInactiveRankDecreasePercent.Size() + i -= size + if _, err := m.DappInactiveRankDecreasePercent.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintNetworkProperties(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x3 + i-- + dAtA[i] = 0xc2 if m.DappMaxMischance != 0 { i = encodeVarintNetworkProperties(dAtA, i, uint64(m.DappMaxMischance)) i-- @@ -1549,11 +1561,16 @@ func (m *NetworkProperties) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.VoteQuorum != 0 { - i = encodeVarintNetworkProperties(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x18 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintNetworkProperties(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a if m.MaxTxFee != 0 { i = encodeVarintNetworkProperties(dAtA, i, uint64(m.MaxTxFee)) i-- @@ -1623,9 +1640,8 @@ func (m *NetworkProperties) Size() (n int) { if m.MaxTxFee != 0 { n += 1 + sovNetworkProperties(uint64(m.MaxTxFee)) } - if m.VoteQuorum != 0 { - n += 1 + sovNetworkProperties(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovNetworkProperties(uint64(l)) if m.MinimumProposalEndTime != 0 { n += 1 + sovNetworkProperties(uint64(m.MinimumProposalEndTime)) } @@ -1776,9 +1792,8 @@ func (m *NetworkProperties) Size() (n int) { if m.DappMaxMischance != 0 { n += 2 + sovNetworkProperties(uint64(m.DappMaxMischance)) } - if m.DappInactiveRankDecreasePercent != 0 { - n += 2 + sovNetworkProperties(uint64(m.DappInactiveRankDecreasePercent)) - } + l = m.DappInactiveRankDecreasePercent.Size() + n += 2 + l + sovNetworkProperties(uint64(l)) l = m.DappPoolSlippageDefault.Size() n += 2 + l + sovNetworkProperties(uint64(l)) if m.MintingFtFee != 0 { @@ -1792,6 +1807,9 @@ func (m *NetworkProperties) Size() (n int) { if m.AutocompoundIntervalNumBlocks != 0 { n += 2 + sovNetworkProperties(uint64(m.AutocompoundIntervalNumBlocks)) } + if m.DowntimeInactiveDuration != 0 { + n += 2 + sovNetworkProperties(uint64(m.DowntimeInactiveDuration)) + } return n } @@ -2090,10 +2108,10 @@ func (m *NetworkProperties) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNetworkProperties @@ -2103,11 +2121,26 @@ func (m *NetworkProperties) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinimumProposalEndTime", wireType) @@ -3218,10 +3251,10 @@ func (m *NetworkProperties) Unmarshal(dAtA []byte) error { } } case 56: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DappInactiveRankDecreasePercent", wireType) } - m.DappInactiveRankDecreasePercent = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNetworkProperties @@ -3231,11 +3264,26 @@ func (m *NetworkProperties) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DappInactiveRankDecreasePercent |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkProperties + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkProperties + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DappInactiveRankDecreasePercent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 57: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DappPoolSlippageDefault", wireType) @@ -3361,6 +3409,25 @@ func (m *NetworkProperties) Unmarshal(dAtA []byte) error { break } } + case 62: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DowntimeInactiveDuration", wireType) + } + m.DowntimeInactiveDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkProperties + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DowntimeInactiveDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipNetworkProperties(dAtA[iNdEx:]) diff --git a/x/gov/types/poll_vote.go b/x/gov/types/poll_vote.go index a51d43ba7..b3ca049d2 100644 --- a/x/gov/types/poll_vote.go +++ b/x/gov/types/poll_vote.go @@ -1,10 +1,6 @@ package types -import ( - "github.com/cosmos/cosmos-sdk/types" - "math/big" - "strconv" -) +import sdk "github.com/cosmos/cosmos-sdk/types" type PollVotes []PollVote @@ -49,14 +45,8 @@ func (c CalculatedPollVotes) VetoVotes() uint64 { func (c CalculatedPollVotes) ProcessResult(properties *NetworkProperties) PollResult { if c.actorsWithVeto != 0 { - resString := strconv.FormatFloat(float64(c.votes[PollOptionNoWithVeto.String()])/float64(c.actorsWithVeto)*100, 'f', -1, 64) + percentageActorsWithVeto := sdk.NewDec(int64(c.votes[PollOptionNoWithVeto.String()])).Quo(sdk.NewDec(int64(c.actorsWithVeto))) - resBig, success := new(big.Int).SetString(resString, 10) - if !success { - return PollUnknown - } - - percentageActorsWithVeto := types.NewDecFromBigIntWithPrec(resBig, 0) if properties.VetoThreshold.LTE(percentageActorsWithVeto) { return PollRejectedWithVeto } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index d237a5118..4bc40a44f 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + errorsmod "cosmossdk.io/errors" kiratypes "github.com/KiraCore/sekai/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types" @@ -25,7 +26,7 @@ func NewProposal( ) (Proposal, error) { msg, ok := content.(proto.Message) if !ok { - return Proposal{}, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("%T does not implement proto.Message", content)) + return Proposal{}, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("%T does not implement proto.Message", content)) } any, err := codectypes.NewAnyWithValue(msg) diff --git a/x/gov/types/quorum.go b/x/gov/types/quorum.go index 30a9a54df..1fd1949e6 100644 --- a/x/gov/types/quorum.go +++ b/x/gov/types/quorum.go @@ -2,18 +2,19 @@ package types import ( "fmt" - "math" + + sdk "github.com/cosmos/cosmos-sdk/types" ) -func IsQuorum(percentage, votes, totalVoters uint64) (bool, error) { +func IsQuorum(percentage sdk.Dec, votes, totalVoters uint64) (bool, error) { if votes > totalVoters { return false, fmt.Errorf("there is more votes than voters: %d > %d", votes, totalVoters) } - if percentage > 100 { - return false, fmt.Errorf("quorum cannot be bigger than 100: %d", percentage) + if percentage.GT(sdk.OneDec()) { + return false, fmt.Errorf("quorum cannot be bigger than 1.00: %d", percentage) } - necessaryApproval := uint64(math.Ceil(float64(totalVoters*percentage) / 100.0)) - return votes >= necessaryApproval, nil + necessaryApproval := sdk.NewDec(int64(totalVoters)).Mul(percentage) + return sdk.NewDec(int64(votes)).GTE(necessaryApproval), nil } diff --git a/x/gov/types/quorum_test.go b/x/gov/types/quorum_test.go index 1a7d381a4..8a818d91f 100644 --- a/x/gov/types/quorum_test.go +++ b/x/gov/types/quorum_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) @@ -25,14 +26,14 @@ func TestIsQuorum_Errors(t *testing.T) { percentage: 101, votes: 7, voters: 10, - expectedErr: fmt.Errorf("quorum cannot be bigger than 100: 101"), + expectedErr: fmt.Errorf("quorum cannot be bigger than 1.00: 1.010000000000000000"), }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { - _, err := IsQuorum(tt.percentage, tt.votes, tt.voters) + _, err := IsQuorum(sdk.NewDecWithPrec(int64(tt.percentage), 2), tt.votes, tt.voters) require.EqualError(t, err, tt.expectedErr.Error()) }) } @@ -63,7 +64,7 @@ func TestIsQuorum(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { - quorum, err := IsQuorum(tt.percentage, tt.votes, tt.voters) + quorum, err := IsQuorum(sdk.NewDecWithPrec(int64(tt.percentage), 2), tt.votes, tt.voters) require.NoError(t, err) require.Equal(t, tt.reached, quorum) }) diff --git a/x/gov/types/router.go b/x/gov/types/router.go index 1e87c70f8..ae84f7c1f 100644 --- a/x/gov/types/router.go +++ b/x/gov/types/router.go @@ -45,7 +45,7 @@ func (r ProposalRouter) AllowedAddressesDynamicProposal(ctx sdk.Context, proposa return dh.AllowedAddresses(ctx, proposal) } -func (r ProposalRouter) QuorumDynamicProposal(ctx sdk.Context, proposal Content) uint64 { +func (r ProposalRouter) QuorumDynamicProposal(ctx sdk.Context, proposal Content) sdk.Dec { h, ok := r.routes[proposal.ProposalType()] if !ok { panic("invalid proposal type") @@ -53,7 +53,7 @@ func (r ProposalRouter) QuorumDynamicProposal(ctx sdk.Context, proposal Content) dh, ok := h.(DynamicVoterProposalHandler) if !ok { - return 0 + return sdk.ZeroDec() } return dh.Quorum(ctx, proposal) } @@ -108,7 +108,7 @@ type ProposalHandler interface { type DynamicVoterProposalHandler interface { ProposalType() string IsAllowedAddress(ctx sdk.Context, addr sdk.AccAddress, proposal Content) bool - Quorum(ctx sdk.Context, proposal Content) uint64 + Quorum(ctx sdk.Context, proposal Content) sdk.Dec VotePeriod(ctx sdk.Context, proposal Content) uint64 VoteEnactment(ctx sdk.Context, proposal Content) uint64 AllowedAddresses(ctx sdk.Context, proposal Content) []string diff --git a/x/layer2/client/cli/tx.go b/x/layer2/client/cli/tx.go index fb91cb3c7..eda425249 100644 --- a/x/layer2/client/cli/tx.go +++ b/x/layer2/client/cli/tx.go @@ -234,7 +234,7 @@ func GetTxCreateDappProposalCmd() *cobra.Command { ExecutorsMax: executorsMax, VerifiersMin: verifiersMin, Status: types.DappStatus(types.SessionStatus_value[statusStr]), - VoteQuorum: voteQuorum, + VoteQuorum: sdk.NewDecWithPrec(int64(voteQuorum), 2), VotePeriod: votePeriod, VoteEnactment: voteEnactment, }, @@ -820,7 +820,7 @@ func GetTxProposalUpsertDappCmd() *cobra.Command { ExecutorsMax: executorsMax, VerifiersMin: verifiersMin, Status: types.DappStatus(types.SessionStatus_value[statusStr]), - VoteQuorum: voteQuorum, + VoteQuorum: sdk.NewDecWithPrec(int64(voteQuorum), 2), VotePeriod: votePeriod, VoteEnactment: voteEnactment, }, diff --git a/x/layer2/keeper/dapp_test.go b/x/layer2/keeper/dapp_test.go index da47fe736..253bb7480 100644 --- a/x/layer2/keeper/dapp_test.go +++ b/x/layer2/keeper/dapp_test.go @@ -42,7 +42,7 @@ func (suite *KeeperTestSuite) TestDappSetGetDelete() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -88,7 +88,7 @@ func (suite *KeeperTestSuite) TestDappSetGetDelete() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, diff --git a/x/layer2/keeper/lp_swap_redeem_convert_test.go b/x/layer2/keeper/lp_swap_redeem_convert_test.go index 96796ed6e..debb6d1da 100644 --- a/x/layer2/keeper/lp_swap_redeem_convert_test.go +++ b/x/layer2/keeper/lp_swap_redeem_convert_test.go @@ -44,7 +44,7 @@ func (suite *KeeperTestSuite) TestLpTokenPrice() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -118,7 +118,7 @@ func (suite *KeeperTestSuite) TestRedeemDappPoolTx() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -193,7 +193,7 @@ func (suite *KeeperTestSuite) TestConvertDappPoolTx() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -239,7 +239,7 @@ func (suite *KeeperTestSuite) TestConvertDappPoolTx() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, diff --git a/x/layer2/keeper/msg_server_test.go b/x/layer2/keeper/msg_server_test.go index 0d864cd48..400b7e518 100644 --- a/x/layer2/keeper/msg_server_test.go +++ b/x/layer2/keeper/msg_server_test.go @@ -67,7 +67,7 @@ func (suite *KeeperTestSuite) TestCreateDappProposal() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) TestBondDappProposal() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, @@ -232,7 +232,7 @@ func (suite *KeeperTestSuite) TestReclaimDappBondProposal() { Postmint: sdk.OneInt(), Time: 1680141605, }, - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 86400, VoteEnactment: 3000, UpdateTimeMax: 60, diff --git a/x/layer2/proposal_handler.go b/x/layer2/proposal_handler.go index 4ce0f5550..59dfd07d0 100644 --- a/x/layer2/proposal_handler.go +++ b/x/layer2/proposal_handler.go @@ -43,12 +43,12 @@ func (a ApplyJoinDappProposalHandler) AllowedAddresses(ctx sdk.Context, proposal return a.keeper.AllowedAddresses(ctx, dapp.Controllers) } -func (a ApplyJoinDappProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyJoinDappProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.ProposalJoinDapp) dapp := a.keeper.GetDapp(ctx, p.DappName) if dapp.Name == "" { - return 0 + return sdk.ZeroDec() } return dapp.VoteQuorum @@ -118,12 +118,12 @@ func (a ApplyUpsertDappProposalHandler) AllowedAddresses(ctx sdk.Context, propos return a.keeper.AllowedAddresses(ctx, dapp.Controllers) } -func (a ApplyUpsertDappProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyUpsertDappProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.ProposalUpsertDapp) dapp := a.keeper.GetDapp(ctx, p.Dapp.Name) if dapp.Name == "" { - return 0 + return sdk.ZeroDec() } return dapp.VoteQuorum diff --git a/x/layer2/types/layer2.pb.go b/x/layer2/types/layer2.pb.go index 7e7bd7793..9f00317da 100644 --- a/x/layer2/types/layer2.pb.go +++ b/x/layer2/types/layer2.pb.go @@ -437,7 +437,7 @@ type Dapp struct { TotalBond github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,16,opt,name=total_bond,json=totalBond,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"total_bond"` CreationTime uint64 `protobuf:"varint,17,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` Status DappStatus `protobuf:"varint,18,opt,name=status,proto3,enum=kira.layer2.DappStatus" json:"status,omitempty"` - VoteQuorum uint64 `protobuf:"varint,19,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,19,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` VotePeriod uint64 `protobuf:"varint,20,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` VoteEnactment uint64 `protobuf:"varint,21,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` LiquidationStart uint64 `protobuf:"varint,22,opt,name=liquidation_start,json=liquidationStart,proto3" json:"liquidation_start,omitempty"` @@ -599,13 +599,6 @@ func (m *Dapp) GetStatus() DappStatus { return Bootstrap } -func (m *Dapp) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *Dapp) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -1664,144 +1657,144 @@ func init() { func init() { proto.RegisterFile("kira/layer2/layer2.proto", fileDescriptor_4070283bbe72a11a) } var fileDescriptor_4070283bbe72a11a = []byte{ - // 2178 bytes of a gzipped FileDescriptorProto + // 2181 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x4b, 0x6f, 0x1b, 0xc9, - 0xf1, 0xd7, 0x88, 0x94, 0x44, 0x35, 0xf5, 0xa0, 0xdb, 0x5a, 0x7b, 0xcc, 0xdd, 0xbf,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dd, 0x31, 0xcd, 0x61, 0x96, 0x5b, 0x45, 0x60, 0xd2, 0x27, 0xa4, 0x98, 0x48, - 0x19, 0xba, 0xe4, 0x86, 0x8b, 0x33, 0x9a, 0x96, 0x56, 0x07, 0xc9, 0xf4, 0x53, 0x32, 0x2f, 0xb2, - 0x6c, 0x71, 0xcb, 0xa8, 0xf9, 0xde, 0x98, 0xe6, 0x44, 0x2e, 0x65, 0xb7, 0x2e, 0x57, 0xa2, 0x1f, - 0x90, 0xe5, 0x7e, 0x12, 0xb0, 0x94, 0x77, 0xe0, 0x9c, 0x3a, 0x11, 0x1b, 0xb8, 0x0b, 0x78, 0x6e, - 0x8b, 0x06, 0x3e, 0x14, 0x11, 0xdf, 0x61, 0x03, 0xfa, 0x35, 0xb2, 0xc8, 0x07, 0xdc, 0xef, 0xa7, - 0x52, 0xe9, 0x4e, 0x24, 0x62, 0x77, 0x11, 0x59, 0x0b, 0x39, 0xb8, 0x23, 0xe2, 0x09, 0x12, 0x1b, - 0xb8, 0x4b, 0x93, 0x24, 0x63, 0xe9, 0x82, 0x2b, 0x71, 0x22, 0xb8, 0xb5, 0xb4, 0x6c, 0x48, 0x39, - 0x08, 0x96, 0x76, 0x09, 0x49, 0x65, 0xca, 0xc2, 0x4e, 0x57, 0xc6, 0x81, 0x5b, 0xc1, 0x8c, 0x6c, - 0xd8, 0x8c, 0x7c, 0xf0, 0x06, 0x19, 0xb9, 0x29, 0x45, 0xec, 0xcd, 0xa3, 0x89, 0x0d, 0x19, 0x07, - 0xb0, 0xa8, 0xaf, 0x38, 0x5c, 0xc8, 0x18, 0x37, 0xea, 0xde, 0x32, 0x8b, 0x66, 0x20, 0x6c, 0x93, - 0x36, 0xc8, 0xac, 0x4e, 0x59, 0xda, 0xd7, 0x2e, 0xad, 0x39, 0x6b, 0x4b, 0x13, 0xc7, 0x06, 0xe9, - 0x7b, 0x80, 0xd3, 0x9e, 0xa5, 0xd1, 0xfb, 0xa4, 0x7c, 0x21, 0x53, 0xde, 0x39, 0xef, 0x4b, 0xd5, - 0x8f, 0xdc, 0xdb, 0x68, 0x93, 0x00, 0xf4, 0x03, 0x44, 0x72, 0x42, 0xc2, 0x95, 0x90, 0x81, 0xbb, - 0x32, 0x24, 0xec, 0x23, 0x42, 0xdf, 0x27, 0x4b, 0x48, 0xe0, 0x31, 0xf3, 0xd3, 0x88, 0xc7, 0xa9, - 0xfb, 0x8e, 0x89, 0x3e, 0xa0, 0xad, 0x0c, 0xa4, 0x1f, 0x92, 0x5b, 0xa1, 0x38, 0xef, 0x8b, 0xc0, - 0xec, 0x40, 0xa7, 0x4c, 0xa5, 0xee, 0x1d, 0x64, 0x56, 0x46, 0x26, 0x0e, 0x00, 0xa7, 0x6d, 0xb8, - 0xcb, 0x32, 0xec, 0x9c, 0x70, 0xee, 0xde, 0x7d, 0xab, 0xd2, 0x35, 0x07, 0xfa, 0x4f, 0x39, 0xa7, - 0xff, 0x4f, 0x16, 0x52, 0xce, 0xa2, 0x8e, 0xe2, 0x9a, 0xab, 0x0b, 0xee, 0xba, 0xe6, 0x12, 0x02, - 0xe6, 0x19, 0x08, 0x28, 0xb6, 0x88, 0x98, 0xc0, 0xde, 0x43, 0xaf, 0xca, 0x16, 0xc3, 0xb8, 0x7e, - 0x9d, 0x2c, 0x41, 0x71, 0xe8, 0x20, 0x29, 0x61, 0x22, 0x70, 0xab, 0x35, 0x67, 0xad, 0xe4, 0x2d, - 0x00, 0xba, 0x23, 0xe2, 0x74, 0x9f, 0x89, 0xa0, 0xfe, 0x33, 0x87, 0x2c, 0x1c, 0x69, 0xae, 0x20, - 0xce, 0x78, 0x66, 0x94, 0x14, 0xfb, 0x9a, 0xab, 0xac, 0x54, 0xc0, 0x98, 0xbe, 0x4b, 0xe6, 0x03, - 0x96, 0x24, 0x1d, 0xac, 0x21, 0xa6, 0x5c, 0x94, 0x00, 0xd8, 0x85, 0x3a, 0xb2, 0x49, 0x8a, 0x98, - 0x2e, 0x85, 0xb7, 0x4b, 0x17, 0x54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x6b, 0xc7, 0x88, + 0x06, 0x67, 0x5c, 0xc3, 0x36, 0x99, 0x4b, 0x14, 0x8f, 0x44, 0x6c, 0x75, 0x7f, 0x25, 0x1b, 0xdb, + 0x71, 0xea, 0x65, 0x74, 0xfa, 0x94, 0x94, 0x12, 0xa9, 0x53, 0x54, 0x55, 0x78, 0x2b, 0x55, 0x39, + 0x1f, 0x0f, 0x57, 0x44, 0xe6, 0xd4, 0x8b, 0x1e, 0x8e, 0xeb, 0x2f, 0x4a, 0xa4, 0xb8, 0xc5, 0x92, + 0xe4, 0xc6, 0xb8, 0xae, 0x90, 0x99, 0x80, 0xc7, 0x32, 0xb2, 0x07, 0x64, 0x26, 0xb4, 0x46, 0xca, + 0x01, 0xd7, 0xbe, 0x12, 0x49, 0x2a, 0x64, 0x6c, 0xc3, 0x3b, 0x2a, 0x82, 0x83, 0x79, 0xce, 0xbb, + 0x5a, 0xa4, 0x59, 0x84, 0xb3, 0x29, 0xec, 0x12, 0xca, 0x9e, 0xcc, 0xe2, 0x0b, 0x63, 0x93, 0x29, + 0xbe, 0x60, 0xa1, 0x3b, 0x9b, 0x65, 0x0a, 0xcc, 0x30, 0x0c, 0xd2, 0xd7, 0xee, 0x9c, 0xc1, 0xc2, + 0x98, 0x7e, 0x46, 0xca, 0xfe, 0xf0, 0x62, 0xb8, 0x25, 0x4c, 0x66, 0x77, 0x2c, 0x99, 0x47, 0x2e, + 0x8e, 0xcd, 0xe5, 0x51, 0x0a, 0x6d, 0x90, 0x42, 0x57, 0xc4, 0xee, 0x7c, 0xad, 0xb0, 0x56, 0x7e, + 0xf4, 0xee, 0x18, 0x73, 0x98, 0xe5, 0x96, 0x08, 0x48, 0xfa, 0x98, 0x14, 0x13, 0x29, 0x43, 0x97, + 0xdc, 0x70, 0x71, 0x46, 0xd3, 0xd2, 0x72, 0x10, 0x4c, 0x3f, 0x23, 0xf3, 0x22, 0xcb, 0x16, 0xb7, + 0x8c, 0xcc, 0xf7, 0xc7, 0x98, 0x13, 0xb9, 0x94, 0xdd, 0xba, 0x9c, 0x44, 0x3f, 0x24, 0xcb, 0xfd, + 0x24, 0x60, 0x29, 0xef, 0x40, 0x9c, 0x3a, 0x11, 0x1b, 0xb8, 0x0b, 0x18, 0xb7, 0x45, 0x23, 0x3e, + 0x14, 0x11, 0xdf, 0x61, 0x03, 0xfa, 0x0d, 0xb2, 0xc8, 0x07, 0xdc, 0xef, 0xa7, 0x52, 0xe9, 0x4e, + 0x24, 0x62, 0x77, 0x11, 0x51, 0x0b, 0xb9, 0x70, 0x47, 0xc4, 0x13, 0x20, 0x36, 0x70, 0x97, 0x26, + 0x41, 0x46, 0xd3, 0x05, 0x57, 0xe2, 0x44, 0x70, 0xab, 0x69, 0xd9, 0x80, 0x72, 0x21, 0x68, 0xda, + 0x25, 0x24, 0x95, 0x29, 0x0b, 0x3b, 0x5d, 0x19, 0x07, 0x6e, 0x05, 0x33, 0xb2, 0x61, 0x33, 0xf2, + 0xfe, 0x1b, 0x64, 0xe4, 0xa6, 0x14, 0xb1, 0x37, 0x8f, 0x2a, 0x36, 0x64, 0x1c, 0xc0, 0xa6, 0xbe, + 0xe2, 0x70, 0x21, 0x63, 0x74, 0xd4, 0xbd, 0x65, 0x36, 0xcd, 0x84, 0xe0, 0x26, 0x6d, 0x90, 0x59, + 0x9d, 0xb2, 0xb4, 0xaf, 0x5d, 0x5a, 0x73, 0xd6, 0x96, 0x26, 0xc2, 0x06, 0xe9, 0x7b, 0x80, 0xcb, + 0x9e, 0x85, 0xd1, 0x3d, 0x52, 0xbe, 0x90, 0x29, 0xef, 0x9c, 0xf7, 0xa5, 0xea, 0x47, 0xee, 0xed, + 0xb7, 0xaa, 0x13, 0x04, 0x54, 0xfc, 0x08, 0x35, 0xd0, 0x7b, 0x56, 0x61, 0xc2, 0x95, 0x90, 0x81, + 0xbb, 0x82, 0x46, 0x22, 0x60, 0x1f, 0x25, 0xf4, 0x03, 0xb2, 0x84, 0x00, 0x1e, 0x33, 0x3f, 0x8d, + 0x78, 0x9c, 0xba, 0xef, 0x98, 0x68, 0x81, 0xb4, 0x95, 0x09, 0xe9, 0x47, 0xe4, 0x56, 0x28, 0xce, + 0xfb, 0x22, 0x30, 0x1e, 0xeb, 0x94, 0xa9, 0xd4, 0xbd, 0x83, 0xc8, 0xca, 0xc8, 0xc2, 0x01, 0xc8, + 0x69, 0x1b, 0xee, 0xbe, 0x0c, 0x3b, 0x27, 0x9c, 0xbb, 0xef, 0xbe, 0x95, 0x0b, 0x73, 0xc0, 0x7f, + 0xc2, 0x39, 0xfd, 0x3a, 0x59, 0x48, 0x39, 0x8b, 0x3a, 0x8a, 0x6b, 0xae, 0x2e, 0xb8, 0xeb, 0x9a, + 0x4b, 0x0b, 0x32, 0xcf, 0x88, 0x00, 0x62, 0x8b, 0x8e, 0x09, 0xc4, 0x5d, 0xb4, 0xaa, 0x6c, 0x65, + 0x18, 0x87, 0x6f, 0x92, 0x25, 0x28, 0x26, 0x1d, 0x04, 0x25, 0x4c, 0x04, 0x6e, 0xb5, 0xe6, 0xac, + 0x95, 0xbc, 0x05, 0x90, 0xee, 0x88, 0x38, 0xdd, 0x67, 0x22, 0xa8, 0xff, 0xc2, 0x21, 0x0b, 0x47, + 0x9a, 0x2b, 0x88, 0x0b, 0xc6, 0x98, 0x92, 0x62, 0x5f, 0x73, 0x95, 0x95, 0x16, 0x18, 0xd3, 0xf7, + 0xc8, 0x7c, 0xc0, 0x92, 0xa4, 0x83, 0x35, 0xc7, 0x94, 0x97, 0x12, 0x08, 0x76, 0xa1, 0xee, 0x6c, + 0x92, 0x22, 0xa6, 0x57, 0xe1, 0xed, 0xd2, 0x0b, 0xc9, 0xf5, 0x3f, 0x15, 0xc8, 0x02, 0x98, 0xb0, + 0x97, 0x70, 0xc5, 0x52, 0x39, 0xb1, 0xa5, 0x33, 0xb1, 0x65, 0x95, 0x94, 0xa4, 0x05, 0x66, 0xe6, + 0x64, 0x73, 0x58, 0xcb, 0x2e, 0x0a, 0x9a, 0x54, 0x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 0xae, 0x87, 0xb7, 0xec, 0xfa, 0xef, 0x72, + 0x3b, 0xec, 0x69, 0x40, 0x75, 0x18, 0xdd, 0xda, 0x4c, 0xe0, 0x22, 0xdb, 0x87, 0x61, 0xf6, 0x20, + 0xb1, 0xd3, 0xf1, 0xfc, 0x2f, 0x4c, 0xe4, 0xff, 0xa7, 0xa4, 0xd4, 0x35, 0xfe, 0x65, 0xc7, 0x72, + 0x53, 0x20, 0xec, 0x11, 0x64, 0x81, 0xc8, 0x18, 0xf5, 0xef, 0x91, 0xf2, 0xc8, 0x69, 0xff, 0x0f, + 0xcb, 0x6e, 0x7c, 0x07, 0xd4, 0xff, 0xe9, 0x10, 0x72, 0xdc, 0xdc, 0xf1, 0xf8, 0x79, 0x9f, 0xeb, + 0x94, 0x7e, 0x4c, 0xe6, 0x8c, 0xc3, 0xe6, 0x99, 0xfb, 0x26, 0x66, 0x64, 0x04, 0x2c, 0x8c, 0xf8, + 0x3c, 0xec, 0x80, 0x5b, 0x36, 0xb3, 0x89, 0x11, 0xe1, 0xeb, 0xe4, 0x03, 0xb2, 0x64, 0x01, 0x36, + 0x85, 0x6c, 0x82, 0x2f, 0x1a, 0x69, 0x76, 0xb0, 0x70, 0x50, 0x5c, 0xa7, 0x46, 0x8b, 0x79, 0xe6, + 0x94, 0x40, 0x80, 0x3a, 0x1e, 0x90, 0x0a, 0x2e, 0x76, 0x79, 0xcc, 0x4f, 0x84, 0x2f, 0x98, 0x32, + 0x15, 0xb3, 0xe8, 0x2d, 0x83, 0x7c, 0x63, 0x28, 0xa6, 0x15, 0x52, 0x80, 0x1b, 0x66, 0xde, 0x23, + 0x30, 0xc4, 0x27, 0x39, 0x3a, 0xab, 0x13, 0x19, 0x6b, 0x8e, 0x08, 0x11, 0xd8, 0x63, 0x82, 0x21, + 0x48, 0x84, 0xf2, 0xad, 0xed, 0x30, 0x04, 0x89, 0x56, 0xbe, 0xb5, 0x14, 0x86, 0x20, 0x09, 0x94, + 0x6f, 0x2d, 0x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 0x35, 0x20, 0xeb, 0xeb, 0xf0, + 0x29, 0x95, 0x81, 0x6d, 0x0a, 0xcc, 0x54, 0x6f, 0x5d, 0x5d, 0xd7, 0xb2, 0x53, 0x30, 0x99, 0x30, + 0x0a, 0x7b, 0x62, 0x4e, 0x71, 0x76, 0x0c, 0xf6, 0x64, 0xe4, 0x10, 0x37, 0x9e, 0xfc, 0xe1, 0xe5, + 0xaa, 0xf3, 0xc5, 0xcb, 0x55, 0xe7, 0xc5, 0xcb, 0x55, 0xe7, 0x6f, 0x2f, 0x57, 0x9d, 0xdf, 0xbe, + 0x5a, 0x9d, 0x7a, 0xf1, 0x6a, 0x75, 0xea, 0x2f, 0xaf, 0x56, 0xa7, 0x7e, 0xb2, 0x36, 0x52, 0xd1, + 0x7f, 0x28, 0x14, 0xdb, 0x94, 0x8a, 0x37, 0x34, 0x3f, 0x63, 0xa2, 0x31, 0xc8, 0xfe, 0x43, 0xc4, + 0xba, 0xde, 0x9d, 0xc5, 0x86, 0xe9, 0xf1, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x08, 0xa2, 0xbc, + 0xd5, 0x5f, 0x14, 0x00, 0x00, } func (this *AccountRange) Equal(that interface{}) bool { @@ -2045,7 +2038,7 @@ func (this *Dapp) Equal(that interface{}) bool { if this.Status != that1.Status { return false } - if this.VoteQuorum != that1.VoteQuorum { + if !this.VoteQuorum.Equal(that1.VoteQuorum) { return false } if this.VotePeriod != that1.VotePeriod { @@ -2916,13 +2909,18 @@ func (m *Dapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xa0 } - if m.VoteQuorum != 0 { - i = encodeVarintLayer2(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x98 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintLayer2(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a if m.Status != 0 { i = encodeVarintLayer2(dAtA, i, uint64(m.Status)) i-- @@ -4041,9 +4039,8 @@ func (m *Dapp) Size() (n int) { if m.Status != 0 { n += 2 + sovLayer2(uint64(m.Status)) } - if m.VoteQuorum != 0 { - n += 2 + sovLayer2(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 2 + l + sovLayer2(uint64(l)) if m.VotePeriod != 0 { n += 2 + sovLayer2(uint64(m.VotePeriod)) } @@ -5748,10 +5745,10 @@ func (m *Dapp) Unmarshal(dAtA []byte) error { } } case 19: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowLayer2 @@ -5761,11 +5758,26 @@ func (m *Dapp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLayer2 + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLayer2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 20: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/recovery/handler.go b/x/recovery/handler.go index 0077d4f92..2a295901c 100644 --- a/x/recovery/handler.go +++ b/x/recovery/handler.go @@ -1,6 +1,7 @@ package recovery import ( + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/recovery/keeper" "github.com/KiraCore/sekai/x/recovery/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -37,7 +38,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { res, err := msgServer.RotateValidatorByHalfRRTokenHolder(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/x/recovery/keeper/recovery.go b/x/recovery/keeper/recovery.go index d613a15ee..e57dc5ad0 100644 --- a/x/recovery/keeper/recovery.go +++ b/x/recovery/keeper/recovery.go @@ -1,16 +1,16 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/recovery/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k Keeper) GetRecoveryRecord(ctx sdk.Context, address string) (types.RecoveryRecord, error) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.RecoveryRecordKey(address)) if bz == nil { - return types.RecoveryRecord{}, sdkerrors.Wrapf(types.ErrRecoveryRecordDoesNotExist, "RecoveryRecord: %s does not exist", address) + return types.RecoveryRecord{}, errorsmod.Wrapf(types.ErrRecoveryRecordDoesNotExist, "RecoveryRecord: %s does not exist", address) } record := types.RecoveryRecord{} k.cdc.MustUnmarshal(bz, &record) @@ -58,7 +58,7 @@ func (k Keeper) GetRecoveryToken(ctx sdk.Context, address string) (types.Recover store := ctx.KVStore(k.storeKey) bz := store.Get(types.RecoveryTokenKey(address)) if bz == nil { - return types.RecoveryToken{}, sdkerrors.Wrapf(types.ErrRecoveryTokenDoesNotExist, "RecoveryToken: %s does not exist", address) + return types.RecoveryToken{}, errorsmod.Wrapf(types.ErrRecoveryTokenDoesNotExist, "RecoveryToken: %s does not exist", address) } recovery := types.RecoveryToken{} k.cdc.MustUnmarshal(bz, &recovery) @@ -69,7 +69,7 @@ func (k Keeper) GetRecoveryTokenByDenom(ctx sdk.Context, denom string) (types.Re store := ctx.KVStore(k.storeKey) bz := store.Get(types.RecoveryTokenByDenomKey(denom)) if bz == nil { - return types.RecoveryToken{}, sdkerrors.Wrapf(types.ErrRecoveryTokenDoesNotExist, "RecoveryTokenByDenom: %s does not exist", denom) + return types.RecoveryToken{}, errorsmod.Wrapf(types.ErrRecoveryTokenDoesNotExist, "RecoveryTokenByDenom: %s does not exist", denom) } address := string(bz) return k.GetRecoveryToken(ctx, address) diff --git a/x/slashing/client/cli/query.go b/x/slashing/client/cli/query.go index b02cf5742..b6536a81c 100644 --- a/x/slashing/client/cli/query.go +++ b/x/slashing/client/cli/query.go @@ -25,7 +25,6 @@ func GetQueryCmd() *cobra.Command { slashingQueryCmd.AddCommand( GetCmdQuerySigningInfo(), - GetCmdQueryParams(), GetCmdQuerySigningInfos(), GetCmdQuerySlashProposals(), GetCmdQuerySlashedStakingPools(), @@ -103,36 +102,6 @@ $ query slashing signing-infos return cmd } -// GetCmdQueryParams implements a command to fetch slashing parameters. -func GetCmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query the current slashing parameters", - Args: cobra.NoArgs, - Long: strings.TrimSpace(`Query genesis parameters for the slashing module: - -$ query slashing params -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryParamsRequest{} - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - // GetCmdQuerySlashProposals implements a command to fetch slash proposals. func GetCmdQuerySlashProposals() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/slashing/genesis.go b/x/slashing/genesis.go index 42aa8fdcd..31d8bf0e9 100644 --- a/x/slashing/genesis.go +++ b/x/slashing/genesis.go @@ -28,15 +28,12 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, stakingKeeper types.Stak } keeper.SetValidatorSigningInfo(ctx, address, info.ValidatorSigningInfo) } - - keeper.SetParams(ctx, data.Params) } // ExportGenesis writes the current store values // to a genesis file, which can be imported again // with InitGenesis func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisState) { - params := keeper.GetParams(ctx) signingInfos := make([]types.SigningInfo, 0) keeper.IterateValidatorSigningInfos(ctx, func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool) { bechAddr := address.String() @@ -48,5 +45,5 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisSt return false }) - return types.NewGenesisState(params, signingInfos) + return types.NewGenesisState(signingInfos) } diff --git a/x/slashing/handler.go b/x/slashing/handler.go index 522e993fd..a70d31e98 100644 --- a/x/slashing/handler.go +++ b/x/slashing/handler.go @@ -1,6 +1,7 @@ package slashing import ( + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/slashing/keeper" "github.com/KiraCore/sekai/x/slashing/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,7 +29,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler { res, err := msgServer.RefuteSlashingProposal(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) + return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } } } diff --git a/x/slashing/keeper/activate.go b/x/slashing/keeper/activate.go index b756510e5..3f8340e84 100644 --- a/x/slashing/keeper/activate.go +++ b/x/slashing/keeper/activate.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/slashing/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Activate calls the staking Activate function to activate a validator if the @@ -19,7 +19,7 @@ func (k Keeper) Activate(ctx sdk.Context, validatorAddr sdk.ValAddress) error { // cannot be activated if not inactivated if !validator.IsInactivated() { - return sdkerrors.Wrap(types.ErrValidatorNotInactivated, "Can NOT activate NOT inactivated validator") + return errorsmod.Wrap(types.ErrValidatorNotInactivated, "Can NOT activate NOT inactivated validator") } consAddr := validator.GetConsAddr() @@ -36,7 +36,7 @@ func (k Keeper) Activate(ctx sdk.Context, validatorAddr sdk.ValAddress) error { // cannot be activated until out of inactive period finish if ctx.BlockTime().Before(signInfo.InactiveUntil) { duration := signInfo.InactiveUntil.Sub(ctx.BlockTime()) - return sdkerrors.Wrap(types.ErrValidatorInactivated, fmt.Sprintf("Can NOT activate inactivate validator, jail time remaining %d seconds", duration/time.Second)) + return errorsmod.Wrap(types.ErrValidatorInactivated, fmt.Sprintf("Can NOT activate inactivate validator, jail time remaining %d seconds", duration/time.Second)) } // automatically set the mischance to 0 and last_present_block to latest_block_height @@ -58,17 +58,17 @@ func (k Keeper) Pause(ctx sdk.Context, validatorAddr sdk.ValAddress) error { // cannot be paused if not paused already if validator.IsJailed() { - return sdkerrors.Wrap(types.ErrValidatorJailed, "Can NOT pause jailed validator") + return errorsmod.Wrap(types.ErrValidatorJailed, "Can NOT pause jailed validator") } // cannot be paused if not paused already if validator.IsInactivated() { - return sdkerrors.Wrap(types.ErrValidatorInactivated, "Can NOT pause inactivated validator") + return errorsmod.Wrap(types.ErrValidatorInactivated, "Can NOT pause inactivated validator") } // cannot be paused if not paused already if validator.IsPaused() { - return sdkerrors.Wrap(types.ErrValidatorPaused, "Can NOT pause already paused validator") + return errorsmod.Wrap(types.ErrValidatorPaused, "Can NOT pause already paused validator") } k.sk.Pause(ctx, validator.ValKey) @@ -84,7 +84,7 @@ func (k Keeper) Unpause(ctx sdk.Context, validatorAddr sdk.ValAddress) error { // cannot be unpaused if not paused if !validator.IsPaused() { - return sdkerrors.Wrap(types.ErrValidatorNotPaused, "Can NOT pause inactivated validator") + return errorsmod.Wrap(types.ErrValidatorNotPaused, "Can NOT unpause NOT paused validator") } k.sk.Unpause(ctx, validator.ValKey) diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go index 0bdf42d1a..f256f12c7 100644 --- a/x/slashing/keeper/grpc_query.go +++ b/x/slashing/keeper/grpc_query.go @@ -17,17 +17,6 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") - } - - ctx := sdk.UnwrapSDKContext(c) - params := k.GetParams(ctx) - - return &types.QueryParamsResponse{Params: params}, nil -} - func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") diff --git a/x/slashing/keeper/infractions.go b/x/slashing/keeper/infractions.go index 13b717ae7..a158d4b74 100644 --- a/x/slashing/keeper/infractions.go +++ b/x/slashing/keeper/infractions.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "time" "github.com/cometbft/cometbft/crypto" @@ -91,7 +92,7 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr crypto.Address, p ), ) k.sk.Inactivate(ctx, validator.ValKey) - signInfo.InactiveUntil = ctx.BlockHeader().Time.Add(k.DowntimeInactiveDuration(ctx)) + signInfo.InactiveUntil = ctx.BlockHeader().Time.Add(time.Second * time.Duration(properties.DowntimeInactiveDuration)) } // Set the updated signing info diff --git a/x/slashing/keeper/keeper.go b/x/slashing/keeper/keeper.go index d78afbb71..cddd0955c 100644 --- a/x/slashing/keeper/keeper.go +++ b/x/slashing/keeper/keeper.go @@ -17,29 +17,22 @@ import ( // Keeper of the slashing store type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.BinaryCodec - sk types.StakingKeeper - gk types.GovKeeper - msk types.MultiStakingKeeper - paramspace types.ParamSubspace - hooks types.SlashingHooks + storeKey storetypes.StoreKey + cdc codec.BinaryCodec + sk types.StakingKeeper + gk types.GovKeeper + msk types.MultiStakingKeeper + hooks types.SlashingHooks } // NewKeeper creates a slashing keeper -func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, sk types.StakingKeeper, msk types.MultiStakingKeeper, gk types.GovKeeper, paramspace types.ParamSubspace) Keeper { - // set KeyTable if it has not already been set - if !paramspace.HasKeyTable() { - paramspace = paramspace.WithKeyTable(types.ParamKeyTable()) - } - +func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, sk types.StakingKeeper, msk types.MultiStakingKeeper, gk types.GovKeeper) Keeper { return Keeper{ - storeKey: key, - cdc: cdc, - sk: sk, - msk: msk, - gk: gk, - paramspace: paramspace, + storeKey: key, + cdc: cdc, + sk: sk, + msk: msk, + gk: gk, } } diff --git a/x/slashing/keeper/keeper_test.go b/x/slashing/keeper/keeper_test.go index 8411b9733..22b41ac58 100644 --- a/x/slashing/keeper/keeper_test.go +++ b/x/slashing/keeper/keeper_test.go @@ -10,7 +10,6 @@ import ( simapp "github.com/KiraCore/sekai/app" appparams "github.com/KiraCore/sekai/app/params" - "github.com/KiraCore/sekai/x/slashing/testslashing" "github.com/KiraCore/sekai/x/staking" "github.com/KiraCore/sekai/x/staking/teststaking" stakingtypes "github.com/KiraCore/sekai/x/staking/types" @@ -214,7 +213,10 @@ func TestValidatorDippingInAndOut(t *testing.T) { // initial setup app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - app.CustomSlashingKeeper.SetParams(ctx, testslashing.TestParams()) + properties := app.CustomGovKeeper.GetNetworkProperties(ctx) + properties.DowntimeInactiveDuration = 60 * 60 + err := app.CustomGovKeeper.SetNetworkProperties(ctx, properties) + require.NoError(t, err) power := int64(100) @@ -279,7 +281,7 @@ func TestValidatorDippingInAndOut(t *testing.T) { ctx = ctx.WithBlockHeight(height) // Try pausing on inactive node here, should fail - err := app.CustomSlashingKeeper.Pause(ctx, valAddr) + err = app.CustomSlashingKeeper.Pause(ctx, valAddr) require.Error(t, err) // validator rejoins and starts signing again @@ -358,8 +360,11 @@ func TestValidatorLifecycle(t *testing.T) { // initial setup app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - app.CustomSlashingKeeper.SetParams(ctx, testslashing.TestParams()) + properties := app.CustomGovKeeper.GetNetworkProperties(ctx) + properties.DowntimeInactiveDuration = 60 * 60 + err := app.CustomGovKeeper.SetNetworkProperties(ctx, properties) + require.NoError(t, err) power := int64(100) @@ -538,7 +543,7 @@ func TestValidatorLifecycle(t *testing.T) { require.True(t, found) require.Equal(t, consAddr.String(), signInfo.Address) require.Equal(t, int64(0), signInfo.StartHeight) - require.Equal(t, ctx.BlockTime().Add(app.CustomSlashingKeeper.DowntimeInactiveDuration(ctx)).String(), signInfo.InactiveUntil.String()) + require.Equal(t, ctx.BlockTime().Add(time.Second*time.Duration(properties.DowntimeInactiveDuration)).String(), signInfo.InactiveUntil.String()) require.Equal(t, int64(0), signInfo.MischanceConfidence) require.Equal(t, int64(0), signInfo.Mischance) require.Equal(t, int64(5000), signInfo.LastPresentBlock) @@ -563,7 +568,7 @@ func TestValidatorLifecycle(t *testing.T) { require.True(t, found) require.Equal(t, consAddr.String(), signInfo.Address) require.Equal(t, int64(0), signInfo.StartHeight) - require.Equal(t, ctx.BlockTime().Add(app.CustomSlashingKeeper.DowntimeInactiveDuration(ctx)).String(), signInfo.InactiveUntil.String()) + require.Equal(t, ctx.BlockTime().Add(time.Second*time.Duration(properties.DowntimeInactiveDuration)).String(), signInfo.InactiveUntil.String()) require.Equal(t, int64(10), signInfo.MischanceConfidence) require.Equal(t, int64(111), signInfo.Mischance) require.Equal(t, int64(5000), signInfo.LastPresentBlock) @@ -571,7 +576,7 @@ func TestValidatorLifecycle(t *testing.T) { require.Equal(t, int64(101), signInfo.ProducedBlocksCounter) // Unjail and check changes - unjailTime := ctx.BlockTime().Add(app.CustomSlashingKeeper.DowntimeInactiveDuration(ctx)) + unjailTime := ctx.BlockTime().Add(time.Second * time.Duration(properties.DowntimeInactiveDuration)) app.CustomStakingKeeper.Unjail(ctx, valAddr) tstaking.CheckValidator(valAddr, stakingtypes.Inactive) signInfo, found = app.CustomSlashingKeeper.GetValidatorSigningInfo(ctx, consAddr) diff --git a/x/slashing/keeper/params.go b/x/slashing/keeper/params.go deleted file mode 100644 index bbc0c80d4..000000000 --- a/x/slashing/keeper/params.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper - -import ( - "time" - - "github.com/KiraCore/sekai/x/slashing/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DowntimeInactiveDuration - Downtime unbond duration -func (k Keeper) DowntimeInactiveDuration(ctx sdk.Context) (res time.Duration) { - k.paramspace.Get(ctx, types.KeyDowntimeInactiveDuration, &res) - return -} - -// GetParams returns the total set of slashing parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramspace.GetParamSet(ctx, ¶ms) - return params -} - -// SetParams sets the slashing parameters to the param space. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramspace.SetParamSet(ctx, ¶ms) -} diff --git a/x/slashing/types/genesis.go b/x/slashing/types/genesis.go index 72a20a614..f213ee522 100644 --- a/x/slashing/types/genesis.go +++ b/x/slashing/types/genesis.go @@ -1,17 +1,8 @@ package types -import ( - "fmt" - "time" -) - // NewGenesisState creates a new GenesisState object -func NewGenesisState( - params Params, signingInfos []SigningInfo, -) *GenesisState { - +func NewGenesisState(signingInfos []SigningInfo) *GenesisState { return &GenesisState{ - Params: params, SigningInfos: signingInfos, } } @@ -19,7 +10,6 @@ func NewGenesisState( // DefaultGenesisState - default GenesisState used by Cosmos Hub func DefaultGenesisState() *GenesisState { return &GenesisState{ - Params: DefaultParams(), SigningInfos: []SigningInfo{}, } } @@ -27,10 +17,5 @@ func DefaultGenesisState() *GenesisState { // ValidateGenesis validates the slashing genesis parameters func ValidateGenesis(data GenesisState) error { - downtimeInactive := data.Params.DowntimeInactiveDuration - if downtimeInactive < 1*time.Minute { - return fmt.Errorf("downtime unblond duration must be at least 1 minute, is %s", downtimeInactive.String()) - } - return nil } diff --git a/x/slashing/types/genesis.pb.go b/x/slashing/types/genesis.pb.go index 74e585a66..82e1beb30 100644 --- a/x/slashing/types/genesis.pb.go +++ b/x/slashing/types/genesis.pb.go @@ -25,11 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the slashing module's genesis state. type GenesisState struct { - // params defines all the paramaters of related to deposit. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // signing_infos represents a map between validator addresses and their // signing infos. - SigningInfos []SigningInfo `protobuf:"bytes,2,rep,name=signing_infos,json=signingInfos,proto3" json:"signing_infos" yaml:"signing_infos"` + SigningInfos []SigningInfo `protobuf:"bytes,1,rep,name=signing_infos,json=signingInfos,proto3" json:"signing_infos" yaml:"signing_infos"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -65,13 +63,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func (m *GenesisState) GetSigningInfos() []SigningInfo { if m != nil { return m.SigningInfos @@ -144,28 +135,26 @@ func init() { } var fileDescriptor_feff3f0a5d59571a = []byte{ - // 331 bytes of a gzipped FileDescriptorProto + // 304 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xce, 0xce, 0x2c, 0x4a, 0xd4, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xc8, 0xcc, 0x4b, 0xd7, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x05, 0x29, 0xd2, 0x83, 0x29, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xe8, 0x83, - 0x58, 0x10, 0x45, 0x52, 0x2a, 0xd8, 0x4d, 0x82, 0x09, 0x40, 0x54, 0x29, 0x2d, 0x62, 0xe4, 0xe2, - 0x71, 0x87, 0x18, 0x1e, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xcc, 0xc5, 0x56, 0x90, 0x58, 0x94, - 0x98, 0x5b, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x87, 0x62, 0x99, 0x5e, 0x00, - 0x58, 0xd2, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x52, 0xa1, 0x58, 0x2e, 0xde, 0xe2, - 0xcc, 0xf4, 0xbc, 0xcc, 0xbc, 0xf4, 0xf8, 0xcc, 0xbc, 0xb4, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x66, - 0x0d, 0x6e, 0x23, 0x29, 0x34, 0xbd, 0xc1, 0x10, 0x35, 0x9e, 0x79, 0x69, 0xf9, 0x4e, 0x32, 0x20, - 0x03, 0x3e, 0xdd, 0x93, 0x17, 0xa9, 0x4c, 0xcc, 0xcd, 0xb1, 0x52, 0x42, 0xd1, 0xae, 0x14, 0xc4, - 0x53, 0x8c, 0x50, 0x5a, 0xac, 0xb4, 0x8a, 0x91, 0x8b, 0x1b, 0x49, 0xaf, 0x90, 0x04, 0x17, 0x7b, - 0x62, 0x4a, 0x4a, 0x51, 0x6a, 0x31, 0xc4, 0x91, 0x9c, 0x41, 0x30, 0xae, 0x50, 0x03, 0x23, 0x97, - 0x58, 0x59, 0x62, 0x4e, 0x66, 0x4a, 0x62, 0x49, 0x7e, 0x51, 0x3c, 0xb2, 0xa1, 0x12, 0x4c, 0x60, - 0xef, 0x28, 0xa3, 0x39, 0x29, 0x0c, 0xa6, 0x18, 0xd9, 0x6d, 0xaa, 0x50, 0xb7, 0xc9, 0x42, 0xdc, - 0x86, 0xdd, 0x40, 0xa5, 0x20, 0x91, 0x32, 0x6c, 0x9a, 0x5d, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, - 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, - 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2b, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, - 0xdf, 0x3b, 0xb3, 0x28, 0xd1, 0x39, 0xbf, 0x28, 0x55, 0xbf, 0x38, 0x35, 0x3b, 0x31, 0x53, 0xbf, - 0x02, 0x11, 0x51, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xe8, 0x31, 0x06, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x10, 0x6c, 0xc4, 0x59, 0x10, 0x02, 0x00, 0x00, + 0x58, 0x10, 0x45, 0x52, 0x2a, 0xd8, 0x4d, 0x82, 0x09, 0x40, 0x54, 0x29, 0xe5, 0x72, 0xf1, 0xb8, + 0x43, 0xcc, 0x0e, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x8a, 0xe5, 0xe2, 0x2d, 0xce, 0x4c, 0xcf, 0xcb, + 0xcc, 0x4b, 0x8f, 0xcf, 0xcc, 0x4b, 0xcb, 0x2f, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x92, + 0xd2, 0x43, 0xb1, 0x52, 0x2f, 0x18, 0xa2, 0xc6, 0x33, 0x2f, 0x2d, 0xdf, 0x49, 0xe6, 0xc4, 0x3d, + 0x79, 0x86, 0x4f, 0xf7, 0xe4, 0x45, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0x50, 0xb4, 0x2b, 0x05, + 0xf1, 0x14, 0x23, 0x94, 0x16, 0x2b, 0xad, 0x62, 0xe4, 0xe2, 0x46, 0xd2, 0x2b, 0x24, 0xc1, 0xc5, + 0x9e, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x0c, 0xb2, 0x88, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x6a, + 0x60, 0xe4, 0x12, 0x2b, 0x4b, 0xcc, 0xc9, 0x4c, 0x49, 0x2c, 0xc9, 0x2f, 0x8a, 0x47, 0x36, 0x54, + 0x82, 0x49, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x19, 0xcd, 0x49, 0x61, 0x30, 0xc5, 0xc8, 0x6e, 0x53, + 0x85, 0xba, 0x4d, 0x16, 0xe2, 0x36, 0xec, 0x06, 0x2a, 0x05, 0x89, 0x94, 0x61, 0xd3, 0xec, 0x72, + 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, + 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x5a, 0xe9, 0x99, 0x25, 0x19, 0xa5, + 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xde, 0x99, 0x45, 0x89, 0xce, 0xf9, 0x45, 0xa9, 0xfa, 0xc5, + 0xa9, 0xd9, 0x89, 0x99, 0xfa, 0x15, 0x88, 0x20, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, + 0x07, 0xb4, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe0, 0x20, 0x4e, 0xda, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -199,19 +188,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -272,8 +251,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) if len(m.SigningInfos) > 0 { for _, e := range m.SigningInfos { l = e.Size() @@ -334,39 +311,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SigningInfos", wireType) } diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index 2d145393a..0e1e9cfea 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -766,73 +766,72 @@ func init() { func init() { proto.RegisterFile("kira/slashing/v1beta1/query.proto", fileDescriptor_7e241c76ab2d5716) } var fileDescriptor_7e241c76ab2d5716 = []byte{ - // 1056 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0xf3, 0xa3, 0x6a, 0x5e, 0x96, 0xaa, 0xcc, 0x16, 0x6d, 0x30, 0x25, 0x3f, 0xbc, 0xdb, - 0x36, 0x74, 0xa9, 0xcd, 0xb6, 0x2c, 0x2a, 0x45, 0x20, 0x36, 0xc0, 0x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x94, 0xfd, 0xad, 0x24, - 0xfe, 0xa4, 0xc1, 0x72, 0x5a, 0xcb, 0xa3, 0x54, 0x6b, 0x2e, 0x18, 0x20, 0xfa, 0x2b, 0xb3, 0x27, - 0x28, 0xa1, 0x9b, 0x42, 0xe8, 0x3a, 0x5a, 0x9d, 0x22, 0x94, 0x7a, 0x49, 0xa9, 0x8d, 0x77, 0x9f, - 0x1c, 0x97, 0xb5, 0xa7, 0xc7, 0x65, 0xed, 0xcf, 0xe3, 0xb2, 0xf6, 0xe8, 0xa4, 0x3c, 0xf7, 0xf4, - 0xa4, 0x3c, 0xf7, 0xfb, 0x49, 0x79, 0xee, 0xd3, 0x8d, 0xc4, 0xdd, 0xf4, 0x01, 0xf5, 0xf1, 0x3b, - 0xcc, 0x27, 0x16, 0x27, 0x1d, 0x4c, 0xad, 0x2f, 0xc6, 0xb4, 0xe2, 0x8e, 0x6a, 0xcd, 0x8b, 0x0f, - 0xc3, 0xed, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x7e, 0x0b, 0x5c, 0x2e, 0x0c, 0x00, 0x00, + // 1029 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xfa, 0x47, 0xa9, 0x9f, 0x4b, 0x54, 0xa6, 0x41, 0x35, 0x4b, 0x64, 0x3b, 0xdb, 0x36, + 0x31, 0x29, 0xd9, 0xa5, 0x09, 0x45, 0x21, 0x08, 0x44, 0x0d, 0x1c, 0x02, 0x97, 0xb0, 0x01, 0x0e, + 0x48, 0x60, 0x8d, 0xbd, 0x93, 0xed, 0xc8, 0xeb, 0x9d, 0xed, 0xce, 0x7a, 0x85, 0x85, 0x90, 0x50, + 0xff, 0x01, 0x2a, 0x71, 0xe0, 0xc0, 0xa5, 0x12, 0x1c, 0xb8, 0xf2, 0x4f, 0xa0, 0x8a, 0x53, 0x25, + 0x2e, 0x9c, 0x02, 0x4a, 0x38, 0xf0, 0x27, 0xa0, 0x9e, 0xd0, 0xce, 0xcc, 0xda, 0xeb, 0x74, 0x9d, + 0x38, 0x82, 0x93, 0xbd, 0x6f, 0xbe, 0xf7, 0xde, 0x37, 0xdf, 0xcc, 0xf7, 0x76, 0x61, 0xa5, 0x4f, + 0x43, 0x6c, 0x71, 0x0f, 0xf3, 0xbb, 0xd4, 0x77, 0xad, 0xf8, 0x56, 0x97, 0x44, 0xf8, 0x96, 0x75, + 0x6f, 0x48, 0xc2, 0x91, 0x19, 0x84, 0x2c, 0x62, 0xe8, 0xd9, 0x04, 0x62, 0xa6, 0x10, 0x7d, 0xc9, + 0x65, 0x2e, 0x13, 0x2b, 0x56, 0xf2, 0x4f, 0x82, 0xf4, 0x65, 0x97, 0x31, 0xd7, 0x23, 0x16, 0x0e, + 0xa8, 0x85, 0x7d, 0x9f, 0x45, 0x38, 0xa2, 0xcc, 0xe7, 0x6a, 0xb5, 0xa1, 0x56, 0xc5, 0x53, 0x77, + 0x78, 0x60, 0x45, 0x74, 0x40, 0x78, 0x84, 0x07, 0x81, 0x02, 0xac, 0xf7, 0x18, 0x1f, 0x30, 0x6e, + 0x75, 0x31, 0x27, 0xb2, 0xf9, 0x98, 0x4a, 0x80, 0x5d, 0xea, 0x8b, 0x6a, 0x0a, 0x7b, 0x3d, 0x9f, + 0x72, 0x1a, 0x50, 0xa8, 0x9a, 0x44, 0x45, 0xb8, 0x9f, 0x80, 0x32, 0xfb, 0xd1, 0xaf, 0x8a, 0x15, + 0x97, 0xc5, 0x09, 0x9d, 0x80, 0x71, 0xec, 0x4d, 0x15, 0x1e, 0x0c, 0xbd, 0x88, 0xa6, 0x79, 0xd9, + 0x07, 0x89, 0x32, 0x96, 0x00, 0x7d, 0x98, 0x54, 0xdb, 0xc3, 0x21, 0x1e, 0x70, 0x9b, 0xdc, 0x1b, + 0x12, 0x1e, 0x19, 0xef, 0xc3, 0x95, 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30, 0x5a, 0x81, 0x4b, + 0x3d, 0xe6, 0xf3, 0x0e, 0x76, 0x9c, 0x90, 0x70, 0xae, 0xaa, 0x56, 0x93, 0xd8, 0x1d, 0x19, 0x42, + 0x37, 0xe1, 0x39, 0xea, 0xf7, 0xbc, 0xa1, 0x43, 0x3a, 0x31, 0xf6, 0xa8, 0x83, 0x23, 0x16, 0x8a, + 0x4e, 0x17, 0xed, 0xcb, 0x6a, 0xe1, 0x93, 0x34, 0x6e, 0xfc, 0xac, 0x41, 0xed, 0xe9, 0x5e, 0xea, + 0xdc, 0xf6, 0xe1, 0x72, 0x8c, 0xbd, 0x0e, 0x97, 0x4b, 0x9d, 0x44, 0x34, 0x75, 0x82, 0xd7, 0x4e, + 0x48, 0x3d, 0x2e, 0x98, 0x29, 0xa3, 0xce, 0x73, 0x31, 0xc6, 0x5e, 0x26, 0x8a, 0xde, 0x86, 0xca, + 0x34, 0xad, 0xea, 0xe6, 0xb2, 0xaa, 0xa6, 0x6e, 0x98, 0xe0, 0x33, 0xae, 0xa8, 0xca, 0x4c, 0x92, + 0x8c, 0x5f, 0x73, 0x38, 0xa7, 0x57, 0x10, 0x7d, 0xad, 0x01, 0x4c, 0xcc, 0xa2, 0xe8, 0xae, 0x9a, + 0xd2, 0x59, 0x66, 0xe2, 0x2c, 0x53, 0xda, 0x40, 0x39, 0xc6, 0xdc, 0xc3, 0x2e, 0x51, 0xc9, 0xed, + 0xed, 0x27, 0x87, 0x8d, 0x57, 0x5d, 0x1a, 0xdd, 0x1d, 0x76, 0xcd, 0x1e, 0x1b, 0x58, 0xca, 0x8f, + 0xf2, 0x67, 0x83, 0x3b, 0x7d, 0x2b, 0x1a, 0x05, 0x84, 0x2b, 0x23, 0x65, 0x32, 0xed, 0x4c, 0xcf, + 0xf3, 0x1d, 0xc0, 0x0f, 0x05, 0x78, 0x21, 0x67, 0x33, 0xea, 0x04, 0xde, 0x84, 0x92, 0x52, 0xbd, + 0x78, 0x3e, 0xd5, 0x45, 0x1a, 0x6a, 0x03, 0x8c, 0x19, 0xf0, 0x5a, 0x41, 0x14, 0x99, 0x47, 0xec, + 0x4c, 0x16, 0xba, 0x3f, 0x2d, 0x68, 0x51, 0x08, 0xba, 0x76, 0xa6, 0xa0, 0x72, 0x03, 0xed, 0xd7, + 0x9f, 0x1c, 0x36, 0x6e, 0x9f, 0x53, 0x51, 0x99, 0x9a, 0x95, 0xd4, 0x58, 0x06, 0x5d, 0x8a, 0x94, + 0x6c, 0x7d, 0x4f, 0x0d, 0xac, 0xf1, 0xd8, 0xf9, 0x18, 0x5e, 0xcc, 0x5d, 0x55, 0x22, 0xbe, 0x06, + 0x95, 0x74, 0xc6, 0x71, 0xa5, 0x24, 0x92, 0x22, 0xb8, 0x2c, 0x36, 0x53, 0x7c, 0x7a, 0xcf, 0xc6, + 0x50, 0x63, 0x05, 0x1a, 0x93, 0xb2, 0xc4, 0xd9, 0x97, 0x8a, 0xed, 0x31, 0x36, 0xe9, 0xfc, 0x39, + 0x34, 0x67, 0x43, 0x54, 0xfb, 0x1d, 0x28, 0x07, 0x49, 0x40, 0xb5, 0xae, 0xcb, 0xd6, 0x53, 0x33, + 0x35, 0x93, 0xa7, 0x68, 0xc8, 0x14, 0xa3, 0x09, 0x75, 0x51, 0xff, 0x4e, 0x2f, 0xa2, 0x31, 0xc9, + 0x63, 0xf0, 0x99, 0x22, 0x99, 0x87, 0xf8, 0x1f, 0x08, 0x18, 0x6a, 0x83, 0xbb, 0x3e, 0x9e, 0x49, + 0xa1, 0x03, 0x2b, 0xa7, 0x60, 0xfe, 0x3b, 0x89, 0xcd, 0x5f, 0x9e, 0x81, 0xb2, 0xe8, 0x80, 0xbe, + 0xd7, 0xa0, 0x9a, 0x1d, 0x26, 0xab, 0x27, 0x1c, 0x31, 0x63, 0x6c, 0xea, 0x6b, 0x67, 0xe2, 0x24, + 0x4d, 0xe3, 0x8d, 0xfb, 0xbf, 0xfd, 0xf5, 0x6d, 0xe1, 0x36, 0xda, 0xb2, 0x66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+ 0x1f, 0xd0, 0x10, 0xbf, 0xc3, 0x42, 0x62, 0x71, 0xd2, 0xc7, 0xd4, 0xfa, 0x62, 0x52, 0x56, 0xbc, + 0x2b, 0xba, 0x17, 0xc4, 0x07, 0xda, 0xd6, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x86, 0x40, 0xee, + 0x48, 0xb6, 0x0b, 0x00, 0x00, } func (this *IdentityRecord) Equal(that interface{}) bool { @@ -891,8 +890,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Params queries the parameters of slashing module - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) // SigningInfos queries signing info of all validators @@ -915,15 +912,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/kira.slashing.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) { out := new(QuerySigningInfoResponse) err := c.cc.Invoke(ctx, "/kira.slashing.Query/SigningInfo", in, out, opts...) @@ -980,8 +968,6 @@ func (c *queryClient) InactiveStakingPools(ctx context.Context, in *QueryInactiv // QueryServer is the server API for Query service. type QueryServer interface { - // Params queries the parameters of slashing module - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(context.Context, *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) // SigningInfos queries signing info of all validators @@ -1000,9 +986,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) SigningInfo(ctx context.Context, req *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SigningInfo not implemented") } @@ -1026,24 +1009,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kira.slashing.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_SigningInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QuerySigningInfoRequest) if err := dec(in); err != nil { @@ -1156,10 +1121,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kira.slashing.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "SigningInfo", Handler: _Query_SigningInfo_Handler, diff --git a/x/slashing/types/query.pb.gw.go b/x/slashing/types/query.pb.gw.go index df9198059..235dea629 100644 --- a/x/slashing/types/query.pb.gw.go +++ b/x/slashing/types/query.pb.gw.go @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - var ( filter_Query_SigningInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"cons_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -237,29 +219,6 @@ func local_request_Query_InactiveStakingPools_0(ctx context.Context, marshaler r // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_SigningInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -439,26 +398,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_SigningInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -583,8 +522,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kira", "slashing", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_SigningInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kira", "slashing", "v1beta1", "signing_infos", "cons_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_SigningInfos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kira", "slashing", "v1beta1", "signing_infos"}, "", runtime.AssumeColonVerbOpt(false))) @@ -599,8 +536,6 @@ var ( ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_SigningInfo_0 = runtime.ForwardResponseMessage forward_Query_SigningInfos_0 = runtime.ForwardResponseMessage diff --git a/x/spending/client/cli/tx.go b/x/spending/client/cli/tx.go index 94af250a5..6850e52da 100644 --- a/x/spending/client/cli/tx.go +++ b/x/spending/client/cli/tx.go @@ -126,7 +126,7 @@ func GetTxCreateSpendingPoolCmd() *cobra.Command { msg := types.NewMsgCreateSpendingPool( name, uint64(claimStart), uint64(claimEnd), rates, - uint64(voteQuorum), uint64(votePeriod), uint64(voteEnactment), + sdk.NewDecWithPrec(int64(voteQuorum), 2), uint64(votePeriod), uint64(voteEnactment), types.PermInfo{ OwnerRoles: ownerRoles, OwnerAccounts: ownerAccounts, @@ -380,7 +380,7 @@ func GetTxUpdateSpendingPoolProposalCmd() *cobra.Command { description, types.NewUpdateSpendingPoolProposal( name, uint64(claimStart), uint64(claimEnd), rates, - uint64(voteQuorum), uint64(votePeriod), uint64(voteEnactment), + sdk.NewDecWithPrec(int64(voteQuorum), 2), uint64(votePeriod), uint64(voteEnactment), types.PermInfo{ OwnerRoles: ownerRoles, OwnerAccounts: ownerAccounts, diff --git a/x/spending/keeper/abci_test.go b/x/spending/keeper/abci_test.go index 9d480e5a2..ca091a30d 100644 --- a/x/spending/keeper/abci_test.go +++ b/x/spending/keeper/abci_test.go @@ -25,7 +25,8 @@ func (suite *KeeperTestSuite) TestEndBlocker() { "spendingpool1", 0, 0, sdk.NewDecCoins(sdk.NewDecCoin("ukex", sdk.NewInt(1))), - 30, 86400, 3000, + sdk.NewDecWithPrec(30, 2), + 86400, 3000, types.PermInfo{ OwnerRoles: []uint64{1}, OwnerAccounts: []string{addr1.String()}, diff --git a/x/spending/keeper/spending_pool_test.go b/x/spending/keeper/spending_pool_test.go index c8bc63485..ddfc052c4 100644 --- a/x/spending/keeper/spending_pool_test.go +++ b/x/spending/keeper/spending_pool_test.go @@ -19,7 +19,7 @@ func (suite *KeeperTestSuite) TestSpendingPoolSetGet() { ClaimStart: 0, ClaimEnd: 0, Rates: sdk.NewDecCoins(sdk.NewDecCoin("ukex", sdk.NewInt(1))), - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 3000, VoteEnactment: 1000, Owners: &types.PermInfo{ @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestSpendingPoolSetGet() { ClaimStart: 0, ClaimEnd: 0, Rates: sdk.NewDecCoins(sdk.NewDecCoin("ukex", sdk.NewInt(1))), - VoteQuorum: 30, + VoteQuorum: sdk.NewDecWithPrec(30, 2), VotePeriod: 3000, VoteEnactment: 1000, Owners: &types.PermInfo{ diff --git a/x/spending/proposal_handler.go b/x/spending/proposal_handler.go index cef3b2866..2d6e7d864 100644 --- a/x/spending/proposal_handler.go +++ b/x/spending/proposal_handler.go @@ -45,12 +45,12 @@ func (a ApplyUpdateSpendingPoolProposalHandler) AllowedAddresses(ctx sdk.Context return a.keeper.AllowedAddresses(ctx, *pool.Owners) } -func (a ApplyUpdateSpendingPoolProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplyUpdateSpendingPoolProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.UpdateSpendingPoolProposal) pool := a.keeper.GetSpendingPool(ctx, p.Name) if pool == nil { - return 0 + return sdk.ZeroDec() } return pool.VoteQuorum @@ -142,12 +142,12 @@ func (a ApplySpendingPoolDistributionProposalHandler) AllowedAddresses(ctx sdk.C return a.keeper.AllowedAddresses(ctx, *pool.Owners) } -func (a ApplySpendingPoolDistributionProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplySpendingPoolDistributionProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.SpendingPoolDistributionProposal) pool := a.keeper.GetSpendingPool(ctx, p.PoolName) if pool == nil { - return 0 + return sdk.ZeroDec() } return pool.VoteQuorum @@ -256,12 +256,12 @@ func (a ApplySpendingPoolWithdrawProposalHandler) AllowedAddresses(ctx sdk.Conte return a.keeper.AllowedAddresses(ctx, *pool.Owners) } -func (a ApplySpendingPoolWithdrawProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) uint64 { +func (a ApplySpendingPoolWithdrawProposalHandler) Quorum(ctx sdk.Context, proposal govtypes.Content) sdk.Dec { p := proposal.(*types.SpendingPoolWithdrawProposal) pool := a.keeper.GetSpendingPool(ctx, p.PoolName) if pool == nil { - return 0 + return sdk.ZeroDec() } return pool.VoteQuorum diff --git a/x/spending/types/genesis.go b/x/spending/types/genesis.go index c198bda53..85de96660 100644 --- a/x/spending/types/genesis.go +++ b/x/spending/types/genesis.go @@ -1,7 +1,10 @@ package types import ( + "encoding/json" + govtypes "github.com/KiraCore/sekai/x/gov/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -14,7 +17,7 @@ func DefaultGenesis() *GenesisState { ClaimStart: 0, ClaimEnd: 0, Rates: sdk.DecCoins{sdk.NewDecCoin("ukex", sdk.NewInt(385))}, // 1k KEX per month per validator - VoteQuorum: 33, + VoteQuorum: sdk.NewDecWithPrec(33, 2), VotePeriod: 300, // 300s VoteEnactment: 300, // 300s Owners: &PermInfo{OwnerRoles: []uint64{govtypes.RoleValidator}}, @@ -26,3 +29,15 @@ func DefaultGenesis() *GenesisState { }, } } + +// GetGenesisStateFromAppState returns x/auth GenesisState given raw application +// genesis state. +func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return genesisState +} diff --git a/x/spending/types/msg.go b/x/spending/types/msg.go index 181a29719..85634c081 100644 --- a/x/spending/types/msg.go +++ b/x/spending/types/msg.go @@ -10,7 +10,7 @@ func NewMsgCreateSpendingPool( claimStart uint64, claimEnd uint64, rates sdk.DecCoins, - voteQuorum uint64, + voteQuorum sdk.Dec, votePeriod uint64, voteEnactment uint64, owners PermInfo, diff --git a/x/spending/types/pool.pb.go b/x/spending/types/pool.pb.go index 48888a480..2a6f1e499 100644 --- a/x/spending/types/pool.pb.go +++ b/x/spending/types/pool.pb.go @@ -288,7 +288,7 @@ type SpendingPool struct { // rate of distribution in the smallest token denomination per 1 second (this value can be a float number, smaller than actual denomination) Rates []github_com_cosmos_cosmos_sdk_types.DecCoin `protobuf:"bytes,5,rep,name=rates,proto3,customtype=github.com/cosmos/cosmos-sdk/types.DecCoin" json:"rates" yaml:"rates"` // pool specific % of owner accounts that must vote YES or NO for any of the pool proposals to be valid. - VoteQuorum uint64 `protobuf:"varint,6,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` // period of time in seconds that any of the pool proposals must last before passing or being rejected VotePeriod uint64 `protobuf:"varint,7,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` // period of time that must pass before any of the pool proposal is enacted @@ -364,13 +364,6 @@ func (m *SpendingPool) GetClaimExpiry() uint64 { return 0 } -func (m *SpendingPool) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *SpendingPool) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -432,52 +425,53 @@ func init() { func init() { proto.RegisterFile("kira/spending/pool.proto", fileDescriptor_6027931ab19c9a21) } var fileDescriptor_6027931ab19c9a21 = []byte{ - // 714 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6b, 0x1b, 0x49, - 0x10, 0xd5, 0xd8, 0x23, 0x59, 0x6a, 0x49, 0xde, 0xdd, 0xde, 0x05, 0x37, 0x36, 0x2b, 0x29, 0x82, - 0x24, 0x22, 0x90, 0x19, 0x70, 0x0e, 0x01, 0x93, 0x43, 0x22, 0x59, 0x81, 0x60, 0x08, 0xce, 0x38, - 0x10, 0x93, 0x8b, 0x68, 0x8d, 0xda, 0x72, 0xe3, 0x99, 0xee, 0xc9, 0x74, 0x2b, 0xb6, 0xfe, 0x45, - 0x20, 0xd7, 0x1c, 0xf2, 0x73, 0x7c, 0xf4, 0x31, 0xe4, 0x60, 0x82, 0x7d, 0xc9, 0x39, 0xbf, 0x20, - 0x74, 0x4d, 0x8f, 0x3e, 0x02, 0x0e, 0x3e, 0xe4, 0xa4, 0xd6, 0xab, 0xf7, 0xaa, 0x6a, 0x5e, 0x15, - 0x85, 0xc8, 0x09, 0x4f, 0xa9, 0xaf, 0x12, 0x26, 0x46, 0x5c, 0x8c, 0xfd, 0x44, 0xca, 0xc8, 0x4b, - 0x52, 0xa9, 0x25, 0xae, 0x9b, 0x88, 0x97, 0x47, 0x36, 0x9b, 0x63, 0x29, 0xc7, 0x11, 0xf3, 0x21, - 0x38, 0x9c, 0x1c, 0xf9, 0x9a, 0xc7, 0x4c, 0x69, 0x1a, 0x27, 0x19, 0x7f, 0xf3, 0xbf, 0xb1, 0x1c, - 0x4b, 0x78, 0xfa, 0xe6, 0x95, 0xa1, 0x6d, 0x8a, 0x2a, 0xbd, 0x88, 0xf2, 0xf8, 0x85, 0x38, 0x92, - 0x98, 0xa0, 0x35, 0x1a, 0x86, 0x72, 0x22, 0x34, 0x71, 0x5a, 0x4e, 0xa7, 0x12, 0xe4, 0x7f, 0xf1, - 0x16, 0xaa, 0x98, 0xd2, 0x03, 0x41, 0x63, 0x46, 0x56, 0x20, 0x56, 0x36, 0xc0, 0x4b, 0x1a, 0x33, - 0xfc, 0x3f, 0x42, 0x11, 0x55, 0x7a, 0x10, 0x9a, 0x44, 0x64, 0x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, 0x67, 0x2a, 0xdb, - 0xd5, 0xa7, 0x22, 0xaa, 0x1d, 0x58, 0xc9, 0xbe, 0x94, 0x91, 0x99, 0x01, 0x2c, 0x49, 0xe6, 0x05, - 0xbc, 0xcd, 0xd4, 0x61, 0x37, 0x06, 0x4a, 0xd3, 0x34, 0x73, 0xc3, 0x0d, 0x10, 0x40, 0x07, 0x06, - 0x31, 0xeb, 0x95, 0x11, 0x98, 0x18, 0xd9, 0x05, 0x2a, 0x03, 0xd0, 0x17, 0x23, 0x7c, 0x07, 0xd5, - 0x6c, 0xf0, 0x2c, 0xe1, 0xe9, 0x94, 0xb8, 0x10, 0xcf, 0x32, 0xf6, 0x01, 0xc2, 0x87, 0xa8, 0x98, - 0x52, 0xcd, 0x14, 0x29, 0x9a, 0x65, 0xe9, 0x76, 0xad, 0xd1, 0x0f, 0x6e, 0x67, 0x74, 0x4f, 0x72, - 0xf1, 0xe3, 0xb2, 0x59, 0x9b, 0xd2, 0x38, 0xda, 0x69, 0x43, 0xa2, 0x76, 0x90, 0x25, 0x34, 0xad, - 0xbf, 0x97, 0x9a, 0x0d, 0xde, 0x4d, 0x64, 0x3a, 0x89, 0x49, 0x29, 0x6b, 0xdd, 0x40, 0xaf, 0x00, - 0x99, 0x11, 0x12, 0x96, 0x72, 0x39, 0x22, 0x6b, 0x73, 0xc2, 0x3e, 0x20, 0x66, 0xa3, 0x81, 0xc0, - 0x04, 0x0d, 0x75, 0xcc, 0x84, 0x26, 0x65, 0xe0, 0xd4, 0x0d, 0xda, 0xcf, 0x41, 0xec, 0xa3, 0x12, - 0xac, 0xb8, 0x22, 0x95, 0x96, 0xd3, 0xa9, 0x6e, 0x6f, 0xfc, 0x32, 0x8e, 0x7c, 0xe4, 0x81, 0xa5, - 0xe1, 0x3e, 0xaa, 0x0f, 0x99, 0x60, 0x47, 0x3c, 0xe4, 0x34, 0xe5, 0x4c, 0x11, 0x04, 0xba, 0xe6, - 0x0d, 0x63, 0x9c, 0xe9, 0x97, 0x55, 0x78, 0x0f, 0x95, 0x87, 0x34, 0xa2, 0x22, 0x64, 0x8a, 0x54, - 0xc1, 0x3d, 0xdf, 0xba, 0x77, 0xff, 0x16, 0xee, 0x19, 0xeb, 0x82, 0x59, 0x02, 0x33, 0xaa, 0xd1, - 0x54, 0xd0, 0x98, 0x87, 0x03, 0x63, 0x1f, 0xa9, 0xb5, 0x9c, 0x4e, 0x39, 0xa8, 0x5a, 0x2c, 0xa0, - 0x9a, 0x61, 0x0f, 0xfd, 0xbb, 0x48, 0xc9, 0x7d, 0xab, 0x83, 0x27, 0xff, 0x2c, 0x30, 0xad, 0x7d, - 0x4f, 0xd0, 0x16, 0x1c, 0x97, 0x25, 0x51, 0x48, 0xa3, 0x70, 0x60, 0x0e, 0x1c, 0x59, 0x07, 0xdd, - 0x86, 0xa1, 0xec, 0xce, 0xb5, 0x3d, 0x1a, 0x85, 0xaf, 0x79, 0xcc, 0xba, 0xbb, 0xe7, 0x57, 0x0d, - 0xe7, 0xe2, 0xaa, 0xe1, 0x7c, 0xbb, 0x6a, 0x38, 0x1f, 0xae, 0x1b, 0x85, 0x8b, 0xeb, 0x46, 0xe1, - 0xcb, 0x75, 0xa3, 0xf0, 0x76, 0x71, 0x37, 0xf6, 0x78, 0x4a, 0x7b, 0x32, 0x65, 0xbe, 0x62, 0x27, - 0x94, 0xfb, 0x67, 0xf3, 0x7b, 0x0b, 0x5f, 0x39, 0x2c, 0xc1, 0xad, 0x7c, 0xf4, 0x33, 0x00, 0x00, - 0xff, 0xff, 0xc4, 0xc1, 0x51, 0x35, 0x8d, 0x05, 0x00, 0x00, + // 723 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x51, 0x6b, 0x13, 0x4b, + 0x14, 0xce, 0xb6, 0x9b, 0x34, 0x39, 0x49, 0x7a, 0xef, 0x9d, 0x7b, 0xa1, 0x43, 0xcb, 0x4d, 0x62, + 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, 0x02, 0x16, 0xf9, 0x5c, 0xd1, 0x2a, 0xa6, 0xed, 0x9a, 0x34, 0xee, 0xde, 0x20, 0x0d, + 0x1d, 0xb5, 0x37, 0x33, 0xd0, 0xa3, 0x1d, 0x4d, 0x23, 0x16, 0x0a, 0x7f, 0xa0, 0xe3, 0xa6, 0xb5, + 0x96, 0xd5, 0x29, 0x7b, 0x55, 0x83, 0x79, 0x2c, 0xe5, 0xc4, 0x81, 0x7f, 0xe7, 0x29, 0x79, 0x6e, + 0x75, 0xcc, 0xe4, 0x9f, 0x39, 0xa6, 0x89, 0xef, 0x11, 0x6c, 0xe0, 0x63, 0xb4, 0x20, 0xf2, 0x59, + 0xe0, 0x0f, 0xf4, 0x83, 0x48, 0x57, 0x51, 0xb7, 0xa6, 0x29, 0xdb, 0x57, 0xda, 0x1e, 0x0b, 0xfc, + 0x57, 0x22, 0xe4, 0xdd, 0xed, 0xd3, 0x8b, 0x86, 0x75, 0x76, 0xd1, 0xb0, 0xbe, 0x5e, 0x34, 0xac, + 0xf7, 0x97, 0x8d, 0xc2, 0xd9, 0x65, 0xa3, 0xf0, 0xf9, 0xb2, 0x51, 0x78, 0x33, 0xbf, 0x4b, 0x3b, + 0x22, 0x61, 0x3d, 0x99, 0x70, 0x57, 0xf1, 0x23, 0x26, 0xdc, 0x93, 0xab, 0xf7, 0x19, 0x7f, 0xe5, + 0xb0, 0x84, 0x6f, 0xeb, 0x83, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x92, 0x8e, 0xa2, 0x88, 0xbd, + 0x05, 0x00, 0x00, } func (this *PermInfo) Equal(that interface{}) bool { @@ -917,11 +911,16 @@ func (m *SpendingPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x38 } - if m.VoteQuorum != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x30 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x32 if len(m.Rates) > 0 { for iNdEx := len(m.Rates) - 1; iNdEx >= 0; iNdEx-- { { @@ -1089,9 +1088,8 @@ func (m *SpendingPool) Size() (n int) { n += 1 + l + sovPool(uint64(l)) } } - if m.VoteQuorum != 0 { - n += 1 + sovPool(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovPool(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovPool(uint64(m.VotePeriod)) } @@ -1913,10 +1911,10 @@ func (m *SpendingPool) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPool @@ -1926,11 +1924,26 @@ func (m *SpendingPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/spending/types/proposal.go b/x/spending/types/proposal.go index 2c0d8f942..da8d9fbe5 100644 --- a/x/spending/types/proposal.go +++ b/x/spending/types/proposal.go @@ -13,7 +13,7 @@ func NewUpdateSpendingPoolProposal( claimStart uint64, claimEnd uint64, rates sdk.DecCoins, - voteQuorum uint64, + voteQuorum sdk.Dec, votePeriod uint64, voteEnactment uint64, owners PermInfo, diff --git a/x/spending/types/proposal.pb.go b/x/spending/types/proposal.pb.go index fda1fdf8f..470cace2e 100644 --- a/x/spending/types/proposal.pb.go +++ b/x/spending/types/proposal.pb.go @@ -35,7 +35,7 @@ type UpdateSpendingPoolProposal struct { ClaimStart uint64 `protobuf:"varint,2,opt,name=claim_start,json=claimStart,proto3" json:"claim_start,omitempty"` ClaimEnd uint64 `protobuf:"varint,3,opt,name=claim_end,json=claimEnd,proto3" json:"claim_end,omitempty"` Rates []github_com_cosmos_cosmos_sdk_types.DecCoin `protobuf:"bytes,4,rep,name=rates,proto3,customtype=github.com/cosmos/cosmos-sdk/types.DecCoin" json:"rates" yaml:"rates"` - VoteQuorum uint64 `protobuf:"varint,5,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` VotePeriod uint64 `protobuf:"varint,6,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` VoteEnactment uint64 `protobuf:"varint,7,opt,name=vote_enactment,json=voteEnactment,proto3" json:"vote_enactment,omitempty"` Owners PermInfo `protobuf:"bytes,8,opt,name=owners,proto3" json:"owners"` @@ -98,13 +98,6 @@ func (m *UpdateSpendingPoolProposal) GetClaimEnd() uint64 { return 0 } -func (m *UpdateSpendingPoolProposal) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *UpdateSpendingPoolProposal) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -260,44 +253,45 @@ func init() { func init() { proto.RegisterFile("kira/spending/proposal.proto", fileDescriptor_e006ef21562b5bc9) } var fileDescriptor_e006ef21562b5bc9 = []byte{ - // 592 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c,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0xdb, - 0x42, 0x05, 0x91, 0x86, 0x63, 0xc6, 0xa3, 0x4f, 0xd7, 0x17, 0xcf, 0xfd, 0xc9, 0x60, 0xd1, 0x5d, - 0xbd, 0x97, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x0d, 0x14, 0xe7, 0x30, 0x04, 0x00, 0x00, + // 605 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0x42, 0x81, 0x76, 0x0a, 0xbf, 0x5f, 0x1c, 0x4d, 0x5c, 0x81, 0x74, 0x6b, 0xe3, 0x9f, + 0xc6, 0x84, 0xdd, 0x44, 0xe3, 0x85, 0x63, 0x81, 0x03, 0x21, 0xd1, 0xba, 0xc4, 0x60, 0xbc, 0x34, + 0xd3, 0xdd, 0x97, 0x65, 0x42, 0x67, 0xde, 0x75, 0x66, 0x2a, 0xf6, 0x5b, 0xf8, 0x11, 0xfc, 0x10, + 0x5e, 0xbd, 0xa3, 0x27, 0x8e, 0xc6, 0x03, 0x31, 0x70, 0xf1, 0xec, 0x27, 0x30, 0x33, 0xbb, 0xd5, + 0x52, 0x2e, 0x9c, 0xba, 0xf3, 0x3c, 0xcf, 0xfb, 0xf4, 0x79, 0x27, 0xcf, 0x90, 0xf5, 0x63, 0xae, + 0x58, 0xa4, 0x73, 0x90, 0x29, 0x97, 0x59, 0x94, 0x2b, 0xcc, 0x51, 0xb3, 0x61, 0x98, 0x2b, 0x34, + 0x48, 0x57, 0x2c, 0x1b, 0x4e, 0xd8, 0xd5, 0x3b, 0x19, 0x66, 0xe8, 0x98, 0xc8, 0x7e, 0x15, 0xa2, + 0xd5, 0x20, 0x43, 0xcc, 0x86, 0x10, 0xb9, 0xd3, 0x60, 0x74, 0x18, 0x19, 0x2e, 0x40, 0x1b, 0x26, + 0xf2, 0x52, 0x70, 0x6f, 0x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 0x37, 0x7b, 0x33, 0xbb, 0x64, 0x89, 0x09, 0x1c, 0x49, 0xa3, 0xfd, 0x79, 0x57, 0xc9, + 0xa8, 0xac, 0xcc, 0xe3, 0x1b, 0x54, 0xc6, 0xf6, 0x31, 0x9e, 0xcc, 0x5f, 0xcb, 0xdf, 0xdd, 0x3e, + 0xbd, 0x68, 0x7a, 0x67, 0x17, 0x4d, 0xef, 0xe7, 0x45, 0xd3, 0xfb, 0x78, 0xd9, 0xac, 0x9c, 0x5d, + 0x36, 0x2b, 0xdf, 0x2f, 0x9b, 0x95, 0xb7, 0xd3, 0x7d, 0xdf, 0xe3, 0x8a, 0x6d, 0xa1, 0x82, 0x48, + 0xc3, 0x31, 0xe3, 0xd1, 0x87, 0x7f, 0x0f, 0xd5, 0xfd, 0xc9, 0x60, 0xd1, 0x3d, 0xd5, 0x67, 0x7f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xd3, 0x59, 0xa9, 0x60, 0x04, 0x00, 0x00, } func (this *UpdateSpendingPoolProposal) Equal(that interface{}) bool { @@ -336,7 +330,7 @@ func (this *UpdateSpendingPoolProposal) Equal(that interface{}) bool { return false } } - if this.VoteQuorum != that1.VoteQuorum { + if !this.VoteQuorum.Equal(that1.VoteQuorum) { return false } if this.VotePeriod != that1.VotePeriod { @@ -488,11 +482,16 @@ func (m *UpdateSpendingPoolProposal) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x30 } - if m.VoteQuorum != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x28 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintProposal(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if len(m.Rates) > 0 { for iNdEx := len(m.Rates) - 1; iNdEx >= 0; iNdEx-- { { @@ -643,9 +642,8 @@ func (m *UpdateSpendingPoolProposal) Size() (n int) { n += 1 + l + sovProposal(uint64(l)) } } - if m.VoteQuorum != 0 { - n += 1 + sovProposal(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovProposal(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovProposal(uint64(m.VotePeriod)) } @@ -845,10 +843,10 @@ func (m *UpdateSpendingPoolProposal) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProposal @@ -858,11 +856,26 @@ func (m *UpdateSpendingPoolProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/spending/types/tx.pb.go b/x/spending/types/tx.pb.go index 02819c005..4d2c881a4 100644 --- a/x/spending/types/tx.pb.go +++ b/x/spending/types/tx.pb.go @@ -39,7 +39,7 @@ type MsgCreateSpendingPool struct { // rate of distribution in the smallest token denomination per 1 second (this value can be a float number, smaller than actual denomination) Rates []github_com_cosmos_cosmos_sdk_types.DecCoin `protobuf:"bytes,5,rep,name=rates,proto3,customtype=github.com/cosmos/cosmos-sdk/types.DecCoin" json:"rates" yaml:"rates"` // pool specific % of owner accounts that must vote YES or NO for any of the pool proposals to be valid. - VoteQuorum uint64 `protobuf:"varint,6,opt,name=vote_quorum,json=voteQuorum,proto3" json:"vote_quorum,omitempty"` + VoteQuorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=vote_quorum,json=voteQuorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_quorum"` // period of time in seconds that any of the pool proposals must last before passing or being rejected VotePeriod uint64 `protobuf:"varint,7,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty"` // period of time that must pass before any of the pool proposal is enacted @@ -114,13 +114,6 @@ func (m *MsgCreateSpendingPool) GetClaimExpiry() uint64 { return 0 } -func (m *MsgCreateSpendingPool) GetVoteQuorum() uint64 { - if m != nil { - return m.VoteQuorum - } - return 0 -} - func (m *MsgCreateSpendingPool) GetVotePeriod() uint64 { if m != nil { return m.VotePeriod @@ -489,52 +482,53 @@ func init() { func init() { proto.RegisterFile("kira/spending/tx.proto", fileDescriptor_edfb840607cf4f3d) } var fileDescriptor_edfb840607cf4f3d = []byte{ - // 711 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, - 0x14, 0x8e, 0x49, 0xc8, 0x4d, 0x26, 0xe4, 0x4a, 0x18, 0x2e, 0xd7, 0x0a, 0xf7, 0xda, 0xb9, 0xbe, - 0x45, 0x8d, 0x28, 0xc4, 0x2a, 0x55, 0x17, 0xed, 0x32, 0x80, 0xaa, 0x0a, 0xa5, 0xa2, 0x66, 0xd1, - 0x9f, 0x4d, 0x34, 0x89, 0x0f, 0x66, 0x94, 0x78, 0xc6, 0x9d, 0x99, 0xb4, 0xe4, 0x29, 0xda, 0x55, - 0x1f, 0xa7, 0x6b, 0x96, 0x6c, 0x2a, 0x55, 0x5d, 0xa0, 0x0a, 0xde, 0xa0, 0x4f, 0x50, 0xcd, 0xc4, - 0x09, 0x49, 0xb0, 0x44, 0xda, 0xae, 0x6c, 0x7f, 0xe7, 0x3b, 0xdf, 0x39, 0x73, 0xce, 0x67, 0x1b, - 0xad, 0x75, 0x09, 0xc7, 0x9e, 0x88, 0x81, 0x06, 0x84, 0x86, 0x9e, 0x3c, 0xad, 0xc7, 0x9c, 0x49, - 0x66, 0x96, 0x15, 0x5e, 0x1f, 0xe1, 0x95, 0xd5, 0x90, 0x85, 0x4c, 0x47, 0x3c, 0x75, 0x37, 0x24, - 0x55, 0x9c, 0x90, 0xb1, 0xb0, 0x07, 0x9e, 0x7e, 0x6a, 0xf7, 0x8f, 0x3d, 0x49, 0x22, 0x10, 0x12, - 0x47, 0x71, 0x42, 0xb0, 0xa6, 0xd5, 0x63, 0xc6, 0x7a, 0xc3, 0x88, 0xfb, 0x29, 0x87, 0xfe, 0x6a, - 0x8a, 0x70, 0x97, 0x03, 0x96, 0x70, 0x94, 0x10, 0x0e, 0x19, 0xeb, 0x99, 0x26, 0xca, 0x51, 0x1c, - 0x81, 0x65, 0x54, 0x8d, 0x5a, 0xd1, 0xd7, 0xf7, 0xa6, 0x83, 0x4a, 0x9d, 0x1e, 0x26, 0x51, 0x4b, - 0x48, 0xcc, 0xa5, 0xb5, 0x50, 0x35, 0x6a, 0x39, 0x1f, 0x69, 0xe8, 0x48, 0x21, 0xe6, 0x3a, 0x2a, - 0x0e, 0x09, 0x40, 0x03, 0x2b, 0xab, 0xc3, 0x05, 0x0d, 0xec, 0xd3, 0xc0, 0xfc, 0x0f, 0x2d, 0x25, - 0xc1, 0xd3, 0x98, 0xf0, 0x81, 0x95, 0xd3, 0xf1, 0xa1, 0xe2, 0xbe, 0x86, 0xcc, 0x97, 0x68, 0x91, - 0x63, 0x09, 0xc2, 0x5a, 0xac, 0x66, 0x6b, 0xc5, 0x46, 0xe3, 0xec, 0xc2, 0xc9, 0x7c, 0xbd, 0x70, - 0x36, 0x43, 0x22, 0x4f, 0xfa, 0xed, 0x7a, 0x87, 0x45, 0x5e, 0x87, 0x89, 0x88, 0x89, 0xe4, 0xb2, - 0x2d, 0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 0xa7, 0x4c, 0x70, - 0x96, 0x54, 0xb9, 0x37, 0x07, 0x69, 0x54, 0xa6, 0xb1, 0x77, 0x76, 0x69, 0x1b, 0xe7, 0x97, 0xb6, - 0xf1, 0xed, 0xd2, 0x36, 0x3e, 0x5c, 0xd9, 0x99, 0xf3, 0x2b, 0x3b, 0xf3, 0xe5, 0xca, 0xce, 0xbc, - 0x9e, 0xfc, 0xbc, 0x1e, 0x10, 0x8e, 0x77, 0x19, 0x07, 0x4f, 0x40, 0x17, 0x13, 0xef, 0x74, 0xe2, - 0x9f, 0xa4, 0x5e, 0xa1, 0x76, 0x5e, 0xff, 0x37, 0x1e, 0xfc, 0x08, 0x00, 0x00, 0xff, 0xff, 0x7d, - 0x9c, 0x15, 0x04, 0xb1, 0x06, 0x00, 0x00, + // 721 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x8d, 0x9b, 0x34, 0xbf, 0x64, 0xd3, 0xfc, 0xa4, 0x6e, 0x4b, 0xb1, 0x52, 0xb0, 0x83, 0xa1, + 0x10, 0x95, 0xd6, 0x16, 0x45, 0x1c, 0xe0, 0x98, 0xb6, 0x42, 0xa8, 0x0a, 0x14, 0xf7, 0xc0, 0x9f, + 0x4b, 0xe4, 0xc4, 0x53, 0x77, 0x95, 0xd8, 0x6b, 0x76, 0x37, 0xd0, 0x7c, 0x0a, 0x38, 0xf1, 0x99, + 0x7a, 0xec, 0x05, 0x09, 0x71, 0xa8, 0x50, 0x7b, 0xe7, 0xc0, 0x27, 0x40, 0xbb, 0x71, 0x42, 0x92, + 0x5a, 0x6a, 0x80, 0x93, 0xed, 0x37, 0x6f, 0xde, 0xcc, 0xce, 0x3c, 0xdb, 0x68, 0xa5, 0x43, 0x98, + 0xe7, 0xf0, 0x18, 0x22, 0x9f, 0x44, 0x81, 0x23, 0x8e, 0xed,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+ 0x2c, 0x53, 0xdf, 0x39, 0x39, 0x37, 0xb4, 0xd3, 0x73, 0x43, 0xfb, 0x7e, 0x6e, 0x68, 0x9f, 0x2e, + 0x8c, 0xcc, 0xe9, 0x85, 0x91, 0xf9, 0x7a, 0x61, 0x64, 0xde, 0x8e, 0x7f, 0x8e, 0xf7, 0x08, 0xf3, + 0xb6, 0x29, 0x03, 0x87, 0x43, 0xc7, 0x23, 0xce, 0xf1, 0xd8, 0x3f, 0x4c, 0xbe, 0x42, 0xad, 0xbc, + 0xfa, 0xcf, 0x3c, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xb9, 0xe8, 0x05, 0xe1, 0x06, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -817,11 +811,16 @@ func (m *MsgCreateSpendingPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x38 } - if m.VoteQuorum != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.VoteQuorum)) - i-- - dAtA[i] = 0x30 + { + size := m.VoteQuorum.Size() + i -= size + if _, err := m.VoteQuorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x32 if len(m.Rates) > 0 { for iNdEx := len(m.Rates) - 1; iNdEx >= 0; iNdEx-- { { @@ -1114,9 +1113,8 @@ func (m *MsgCreateSpendingPool) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - if m.VoteQuorum != 0 { - n += 1 + sovTx(uint64(m.VoteQuorum)) - } + l = m.VoteQuorum.Size() + n += 1 + l + sovTx(uint64(l)) if m.VotePeriod != 0 { n += 1 + sovTx(uint64(m.VotePeriod)) } @@ -1394,10 +1392,10 @@ func (m *MsgCreateSpendingPool) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteQuorum", wireType) } - m.VoteQuorum = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1407,11 +1405,26 @@ func (m *MsgCreateSpendingPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VoteQuorum |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VoteQuorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) diff --git a/x/staking/keeper/slash.go b/x/staking/keeper/slash.go index 75f33befb..2b1850d8d 100644 --- a/x/staking/keeper/slash.go +++ b/x/staking/keeper/slash.go @@ -3,11 +3,11 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" govtypes "github.com/KiraCore/sekai/x/gov/types" "github.com/KiraCore/sekai/x/staking/types" stakingtypes "github.com/KiraCore/sekai/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Activate a validator @@ -18,15 +18,15 @@ func (k Keeper) Activate(ctx sdk.Context, valAddress sdk.ValAddress) error { } if validator.IsPaused() { - return sdkerrors.Wrap(stakingtypes.ErrValidatorPaused, "Can NOT activate paused validator, you must unpause") + return errorsmod.Wrap(stakingtypes.ErrValidatorPaused, "Can NOT activate paused validator, you must unpause") } if validator.IsJailed() { - return sdkerrors.Wrap(stakingtypes.ErrValidatorJailed, "Can NOT activate jailed validator, you must unjail via proposal") + return errorsmod.Wrap(stakingtypes.ErrValidatorJailed, "Can NOT activate jailed validator, you must unjail via proposal") } if validator.IsActive() { - return sdkerrors.Wrap(stakingtypes.ErrValidatorActive, "Can NOT activate already active validator") + return errorsmod.Wrap(stakingtypes.ErrValidatorActive, "Can NOT activate already active validator") } k.setStatusToValidator(ctx, validator, stakingtypes.Active) diff --git a/x/staking/keeper/slash_test.go b/x/staking/keeper/slash_test.go index 2906885b8..f8e191f88 100644 --- a/x/staking/keeper/slash_test.go +++ b/x/staking/keeper/slash_test.go @@ -5,8 +5,7 @@ import ( "testing" "time" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - + errorsmod "cosmossdk.io/errors" "github.com/KiraCore/sekai/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -303,7 +302,7 @@ func TestValidatorActivate_Errors(t *testing.T) { }, { name: "validator is paused", - expectedError: sdkerrors.Wrap(types.ErrValidatorPaused, "Can NOT activate paused validator, you must unpause"), + expectedError: errorsmod.Wrap(types.ErrValidatorPaused, "Can NOT activate paused validator, you must unpause"), prepareScenario: func(app *simapp.SekaiApp, ctx sdk.Context, validator types.Validator) { validator.Status = types.Paused app.CustomStakingKeeper.AddValidator(ctx, validator) diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 6b7d64651..826a653a5 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -81,7 +82,7 @@ func (v Validator) GetConsPubKey() cryptotypes.PubKey { func (v Validator) ConsPubKey() (cryptotypes.PubKey, error) { pk, ok := v.PubKey.GetCachedValue().(cryptotypes.PubKey) if !ok { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) } return pk, nil diff --git a/x/tokens/types/genesis.go b/x/tokens/types/genesis.go index dc56e1a7e..49ecce7e4 100644 --- a/x/tokens/types/genesis.go +++ b/x/tokens/types/genesis.go @@ -1,6 +1,9 @@ package types import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -22,3 +25,15 @@ func DefaultGenesis() *GenesisState { }, } } + +// GetGenesisStateFromAppState returns x/auth GenesisState given raw application +// genesis state. +func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return genesisState +} diff --git a/x/ubi/keeper/ubi.go b/x/ubi/keeper/ubi.go index e3041aea6..2740358d5 100644 --- a/x/ubi/keeper/ubi.go +++ b/x/ubi/keeper/ubi.go @@ -4,11 +4,11 @@ import ( "fmt" "strings" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/KiraCore/sekai/x/ubi/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) @@ -53,7 +53,7 @@ func (k Keeper) DeleteUBIRecord(ctx sdk.Context, name string) error { store := ctx.KVStore(k.storeKey) key := append([]byte(types.PrefixKeyUBIRecord), []byte(name)...) if !store.Has(key) { - return sdkerrors.Wrap(types.ErrUBIRecordDoesNotExists, fmt.Sprintf("ubi record does not exist: %s", name)) + return errorsmod.Wrap(types.ErrUBIRecordDoesNotExists, fmt.Sprintf("ubi record does not exist: %s", name)) } store.Delete(key)