diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index 872d3309..4e796d25 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -7,14 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: Run Snyk to check for vulnerabilities - uses: snyk/actions/golang@master - continue-on-error: true # To make sure that SARIF upload gets called - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: - args: --sarif-file-output=snyk.sarif - - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@v2 + - uses: snyk/actions/setup@master + - uses: actions/setup-go@v1 with: - sarif_file: snyk.sarif \ No newline at end of file + go-version: '1.20' + - name: Snyk monitor + run: snyk code test + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} \ No newline at end of file diff --git a/client/docs/swagger-ui/swagger.json b/client/docs/swagger-ui/swagger.json index c01880c6..d6a6c4d1 100644 --- a/client/docs/swagger-ui/swagger.json +++ b/client/docs/swagger-ui/swagger.json @@ -6347,15 +6347,15 @@ ] } }, - "/haqq/coinomics/v1/inflation_rate": { + "/haqq/coinomics/v1/params": { "get": { - "summary": "InflationRate retrieves current era inflation rate.", - "operationId": "InflationRate", + "summary": "Params retrieves coinomics moudle params.", + "operationId": "Params", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/haqq.coinomics.v1.QueryInflationRateResponse" + "$ref": "#/definitions/haqq.coinomics.v1.QueryParamsResponse" } }, "default": { @@ -6370,15 +6370,15 @@ ] } }, - "/haqq/coinomics/v1/params": { + "/haqq/coinomics/v1/reward_coefficient": { "get": { - "summary": "Params retrieves coinomics moudle params.", - "operationId": "Params", + "summary": "InflationRewardCoefficientRate APY rate for staking rewards", + "operationId": "RewardCoefficient", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/haqq.coinomics.v1.QueryParamsResponse" + "$ref": "#/definitions/haqq.coinomics.v1.QueryRewardCoefficientResponse" } }, "default": { @@ -6448,52 +6448,6 @@ ] } }, - "/haqqd/coinomics/v1/era": { - "get": { - "summary": "Era retrieves current era.", - "operationId": "Era", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/haqq.coinomics.v1.QueryEraResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/google.rpc.Status" - } - } - }, - "tags": [ - "Query" - ] - } - }, - "/haqqd/coinomics/v1/era_closing_supply": { - "get": { - "summary": "EraTargetSupply retrieves current era target supply.", - "operationId": "EraClosingSupply", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/haqq.coinomics.v1.QueryEraClosingSupplyResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/google.rpc.Status" - } - } - }, - "tags": [ - "Query" - ] - } - }, "/haqqd/coinomics/v1/max_supply": { "get": { "summary": "MaxSupply retrieves total coins of all eras and when mint ended.", @@ -13056,61 +13010,43 @@ "type": "string", "title": "type of coin to mint" }, - "blocksPerEra": { - "type": "string", - "format": "uint64", - "title": "number of blocks per era" - }, "enableCoinomics": { "type": "boolean", "title": "parameter to enable coinmoics" + }, + "rewardCoefficient": { + "type": "string", + "title": "current staking reward coefficient" } }, "description": "Params holds parameters for the coinomics module." }, - "haqq.coinomics.v1.QueryEraClosingSupplyResponse": { + "haqq.coinomics.v1.QueryMaxSupplyResponse": { "type": "object", "properties": { - "eraClosingSupply": { + "maxSupply": { "$ref": "#/definitions/cosmos.base.v1beta1.Coin" } } }, - "haqq.coinomics.v1.QueryEraResponse": { + "haqq.coinomics.v1.QueryParamsResponse": { "type": "object", "properties": { - "era": { - "type": "string", - "format": "uint64" + "params": { + "$ref": "#/definitions/haqq.coinomics.v1.Params", + "description": "params defines the parameters of the module." } } }, - "haqq.coinomics.v1.QueryInflationRateResponse": { + "haqq.coinomics.v1.QueryRewardCoefficientResponse": { "type": "object", "properties": { - "inflationRate": { + "rewardCoefficient": { "type": "string", "title": "rate by which the total supply increases within one era" } } }, - "haqq.coinomics.v1.QueryMaxSupplyResponse": { - "type": "object", - "properties": { - "maxSupply": { - "$ref": "#/definitions/cosmos.base.v1beta1.Coin" - } - } - }, - "haqq.coinomics.v1.QueryParamsResponse": { - "type": "object", - "properties": { - "params": { - "$ref": "#/definitions/haqq.coinomics.v1.Params", - "description": "params defines the parameters of the module." - } - } - }, "haqq.vesting.v1.QueryBalancesResponse": { "type": "object", "properties": { diff --git a/docker/build.Dockerfile b/docker/build.Dockerfile index ee1cfa22..1c9a48b5 100644 --- a/docker/build.Dockerfile +++ b/docker/build.Dockerfile @@ -24,11 +24,11 @@ COPY --from=build-env /go/bin/cosmovisor /usr/bin/cosmovisor COPY --from=build-env /go/src/github.com/haqq-network/haqq/build/haqqd /usr/bin/haqqd RUN apk add --no-cache \ - ca-certificates=20230506-r0 jq=~1.6 \ - curl=~8.4 bash=~5.2 \ - vim=~9.0 lz4=~1.9 \ - tini=~0.19 \ - gcompat=~1.1 + ca-certificates jq \ + curl bash \ + vim lz4 \ + tini \ + gcompat RUN addgroup -g 1000 haqq \ && adduser -S -h /home/haqq -D haqq -u 1000 -G haqq diff --git a/proto/haqq/coinomics/v1/genesis.proto b/proto/haqq/coinomics/v1/genesis.proto index 96935ed4..bdc7d81d 100644 --- a/proto/haqq/coinomics/v1/genesis.proto +++ b/proto/haqq/coinomics/v1/genesis.proto @@ -12,7 +12,7 @@ message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; // prev block block ts - string prev_block_ts = 2 [ + string prev_block_ts = 2 [ (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; diff --git a/x/coinomics/keeper/inflation.go b/x/coinomics/keeper/inflation.go index 68fe6e16..dd1df91c 100644 --- a/x/coinomics/keeper/inflation.go +++ b/x/coinomics/keeper/inflation.go @@ -15,7 +15,7 @@ func (k Keeper) MintAndAllocate(ctx sdk.Context) error { currentBlockTS, _ := sdk.NewDecFromStr(math.NewInt(ctx.BlockTime().UnixMilli()).String()) // Skip minting for the first block after activation, waiting for previous block timestamp to be set - if k.GetPrevBlockTS(ctx) == sdk.ZeroInt() { + if k.GetPrevBlockTS(ctx).Equal(sdk.ZeroInt()) { k.SetPrevBlockTS(ctx, currentBlockTS.RoundInt()) return nil }