Skip to content

Commit

Permalink
feat: cheqd-node v2 upgrade [DEV-3797] (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipdjokic committed Apr 17, 2024
1 parent d2502a9 commit de4cfdd
Show file tree
Hide file tree
Showing 268 changed files with 4,306 additions and 2,057 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: ''
labels: 'kind/bug'
assignees: 'RiccardoM'
assignees: 'MonikaCat'

---
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
Expand Down
1 change: 0 additions & 1 deletion .github/linters/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- gocritic
- gofmt
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ jobs:
file: Dockerfile
platforms: linux/amd64
load: true
target: bdjuno
target: callisto
tags: ${{ steps.meta.outputs.tags }}
outputs: type=docker,dest=/tmp/bdjuno-build.tar
outputs: type=docker,dest=/tmp/callisto-build.tar
cache-from: type=gha
cache-to: type=gha,mode=min

- name: Upload Docker test image
uses: actions/upload-artifact@v3
with:
name: bdjuno-build.tar
path: /tmp/bdjuno-build.tar
name: callisto-build.tar
path: /tmp/callisto-build.tar

build-hasuracli:
name: "Hasura CLI Docker Image"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache: true
cache: false # temporarily off, as golangci-lint doesn't align 100% with cached setup-go@v4, see: https://github.com/golangci/golangci-lint-action/issues/807

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --config .github/linters/.golangci.yaml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ jobs:
type=raw,value=${{ steps.set-network.outputs.NETWORK_NAME }}-latest
type=sha,format=long
labels: |
org.opencontainers.image.description="BDJuno for cheqd network"
org.opencontainers.image.description="Callisto for cheqd network"
org.opencontainers.image.source="https://github.com/cheqd/bdjuno"
org.opencontainers.image.vendor="Cheqd Foundation Limited"
org.opencontainers.image.created={{date 'dddd, MMMM Do YYYY, h:mm:ss a'}}
org.opencontainers.image.documentation="https://docs.cheqd.io/node"
- name: Build BDJuno image
- name: Build Callisto image
uses: docker/build-push-action@v4
with:
context: .
Expand Down
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### APP-SPECIFIC EXCLUSIONS ###
.bdjuno/**
.idea/
build/
vendor/

# Configuration
*.toml
*.json
config.yaml

# Coverage
coverage.*
Expand Down
20 changes: 20 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
queue_rules:
- name: default
conditions:
- or:
- base~=cosmos/
- base~=chains/

pull_request_rules:
- name: automerge with label automerge and branch protection passing
conditions:
- "#approved-reviews-by>0"
- label=automerge
actions:
queue:
name: default
method: squash
commit_message_template: >
{{ title }} (#{{ number }})
{{ body }}
162 changes: 162 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
## Unreleased

### Changes

#### [cheqd]
- ([\#545](https://github.com/forbole/callisto/pull/545)) Added `x/did` and `x/resource` module handlers to store data in db
- ([\#550](https://github.com/forbole/callisto/pull/550)) Updated validators VP handlers, `voting_power` column type to TEXT, updated VotingPower type to `sdkmath.Int` for ValidatorVotingPower and ProposalValidatorStatusSnapshot struct
- ([\#580](https://github.com/forbole/callisto/pull/580)) Removed `redelegation` from top accounts calculations

#### [cheqd] Top Accounts Module
- ([\#510](https://github.com/forbole/callisto/pull/510)) Implemented `top_accounts` module to store chain native token's balance for ranking
- ([\#511](https://github.com/forbole/callisto/pull/511)) Implemented parse cmd for `top_accounts` module
- ([\#520](https://github.com/forbole/callisto/pull/520)) Upgraded `cheqd-node` to `v1.2.2` and proposals parsing to correctly parse `v0.46.x` gov proposals
- ([\#547](https://github.com/forbole/callisto/pull/547)) Upgraded `cheqd-node` to `v1.3.0` and added MsgDeactivateDidDoc handling
- ([\#552](https://github.com/forbole/callisto/pull/552)) Upgraded `cheqd-node` to `v1.4.0`
- ([\#555](https://github.com/forbole/callisto/pull/555)) Added `height` column to top accounts table
- ([\#560](https://github.com/forbole/callisto/pull/560)) Stored latest block height instead of height `0` when updating top accounts and added RefreshAvailableBalance to periodic ops
- ([\#570](https://github.com/forbole/callisto/pull/570)) Added `type` column to top accounts table, stored account type with top accounts module and added RefreshTopAccountsList to periodic ops

#### CI
- ([\#508](https://github.com/forbole/callisto/pull/508)) Upgrade workflow golangci version to v1.50.1
- ([\#610](https://github.com/forbole/callisto/pull/610)) Add support for gov `v1` proposals
- ([\#652](https://github.com/forbole/callisto/pull/652)) Update gov module parsing
- ([\#702](https://github.com/forbole/callisto/pull/702)) Add `message_type` module and store msg types inside `message_type` table, add `messages_by_type` function to allow to query messages by their types
- ([\#704](https://github.com/forbole/callisto/pull/704)) Update `BDJuno` name to `Callisto`

## Version v4.0.0
## Notes
This version is thought to be used with Cosmos SDK `v0.47.x`.

### Changes

#### Parse Command
- ([\#492](https://github.com/forbole/callisto/pull/492)) Add parse command for periodic tasks: `x/bank` total supply, `x/distribution` community pool, `x/mint` inflation, `pricefeed` token price and price history, `x/staking` staking pool

#### Upgrade Module
- ([\#467](https://github.com/forbole/callisto/pull/467)) Store software upgrade plan and refresh data at upgrade height

#### Staking Module
- ([\#443](https://github.com/forbole/callisto/pull/443)) Remove tombstone status from staking module(already stored in slashing module)
- ([\#455](https://github.com/forbole/callisto/pull/455)) Added `unbonding_tokens` and `staked_not_bonded_tokens` values to staking pool table
- ([\#536](https://github.com/forbole/callisto/pull/536)) Fix `PoolSnapshot` tokens type from `sdk.Int` to `sdkmath.Int`

#### Gov Module
- ([\#461](https://github.com/forbole/callisto/pull/461)) Parse `x/gov` genesis with `genesisDoc.InitialHeight` instead of the hard-coded height 1
- ([\#465](https://github.com/forbole/callisto/pull/465)) Get open proposal ids in deposit or voting period by block time instead of current time
- ([\#489](https://github.com/forbole/callisto/pull/489)) Remove block height foreign key from proposal_vote and proposal_deposit tables and add column timestamp
- ([\#499](https://github.com/forbole/callisto/pull/499)) Check if proposal has passed voting end time before marking it invalid
- ([\#523](https://github.com/forbole/callisto/pull/523)) Update proposal snapshots handling on block
- ([\#681](https://github.com/forbole/callisto/pull/681)) Handle proposal status change from deposit to voting
-
#### Daily refetch
- ([\#454](https://github.com/forbole/callisto/pull/454)) Added `daily refetch` module to refetch missing blocks every day

#### Hasura
- ([\#473](https://github.com/forbole/callisto/pull/473)) Improved Hasura permissions
- ([\#491](https://github.com/forbole/callisto/pull/491)) Add host address to Hasura actions

### Dependencies
- ([\#542](https://github.com/forbole/callisto/pull/542)) Updated Juno to `v5.1.0`


## Version v3.2.0
### Changes
#### Mint module
- ([\#432](https://github.com/forbole/callisto/pull/432)) Update inflation rate when mint param change proposal is passed

#### Gov module
- ([\#401](https://github.com/forbole/callisto/pull/401)) Update the proposal status to the latest in `callisto parse gov proposal [id]` command
- ([\#430](https://github.com/forbole/callisto/pull/430)) Update the proposals that have invalid status but can still be in voting or deposit periods

### Dependencies
- ([\#440](https://github.com/forbole/callisto/pull/440)) Updated Juno to `v3.3.0`

## Version v3.1.0
### Dependencies
- Updated Juno to `v3.2.0`

### Changes
#### Hasura
- ([\#395](https://github.com/forbole/callisto/pull/395)) Remove time label from Hasura Prometheus monitoring

#### Bank module
- ([\#410](https://github.com/forbole/callisto/pull/410)) Change total supply query from only 1 page to all pages

## Version v3.0.1
### Dependencies
- Updated Juno to `v3.1.1`

## Version v3.0.0
### Notes
This version introduces breaking changes to `transaction` and `message` PostgreSQL tables. It implements PostgreSQL table partitioning to fix slow data retrieval from database that stores large amount of transactions and messages. Read more details about [migrating to v3.0.0](https://docs.bigdipper.live/cosmos-based/parser/migrations/v2.0.0)

### New features
#### CLI
- ([\#356](https://github.com/forbole/callisto/pull/356)) Implemented `migrate` command to perform easy migration to higher BDJuno versions
- ([\#356](https://github.com/forbole/callisto/pull/356)) Updated `parse-genesis` command to parse genesis file without accessing the node

#### Database
- ([\#356](https://github.com/forbole/callisto/pull/356)) Added PostgreSQL table partition to `transaction` and `message` table
- ([\#356](https://github.com/forbole/callisto/pull/356)) Created new `messages_by_address` function

### Changes
#### Hasura
- ([\#377](https://github.com/forbole/callisto/pull/377)) Updated Hasura metadata
- ([\#381](https://github.com/forbole/callisto/pull/381)) Hasura actions are now a module

### Dependencies
- ([\#356](https://github.com/forbole/callisto/pull/356)) Updated Juno to `v3.0.0`

## Version v2.0.0
### Notes
This version introduces breaking changes to certain address-specific data that is no longer periodically parsed from the node and stored in the database. Instead, the data is now obtained directly from the node when needed using Hasura Actions. Read more details about [migrating to v2.0.0](https://docs.bigdipper.live/cosmos-based/parser/migrations/v2.0.0)

### New features
#### CLI
- ([\#257](https://github.com/forbole/callisto/pull/257)) Added `parse-genesis` command to parse the genesis file
- ([\#228](https://github.com/forbole/callisto/pull/228)) ([\#248](https://github.com/forbole/callisto/pull/248)) Added `fix` command:
- `auth`: fix vesting accounts details
- `blocks`: fix missing blocks and transactions from given start height
- `gov`: fix proposal with given proposal ID
- `staking`: fix validators info at the latest height

#### Hasura Actions
- ([\#329](https://github.com/forbole/callisto/pull/329)) Implemented Hasura Actions service to replace periodic queries. If you are using GraphQL queries on your application, you should updated the old queries to use the below new actions instead.
Here's a list of data acquired through Hasura Actions:
- Of a certain address/delegator:
- Account balance (`action_account_balance`)
- Delegation rewards (`action_delegation_reward`)
- Delegator withdraw address (`action_delegator_withdraw_address`)
- Delegations (`action_delegation`)
- Total delegations amount (`action_delegation_total`)
- Unbonding delegations (`action_unbonding_delegation`)
- Total unbonding delegations amount (`action_unbonding_delegation_total`)
- Redelegations (`action_redelegation`)
- Of a certain validator:
- Commission amount (`action_validator_commission_amount`)
- Delegations to this validator (`action_validator_delegations`)
- Redelegations from this validator (`action_validator_redelegations_from`)
- Unbonding delegations (`action_validator_unbonding_delegations`)
- ([\#352](https://github.com/forbole/callisto/pull/352)) Added prometheus monitoring to hasura actions

#### Local node support
- Added the support for `node.type = "local"` for parsing a static local node without the usage gRPC queries: [config reference](https://docs.bigdipper.live/cosmos-based/parser/config/config#node).

#### Modules
- ([\#232](https://github.com/forbole/callisto/pull/232)) Updated the `x/auth` module support to handle and store `vesting accounts` and `vesting periods` inside the database.
- ([\#276](https://github.com/forbole/callisto/pull/276)) Added the support for the `x/feegrant` module (v0.44.x)

### Changes

#### CLI
- ([\#351](https://github.com/forbole/callisto/pull/351)) Fixed version display for `callisto version` cmd

#### Database
- ([\#300](https://github.com/forbole/callisto/pull/300)) Changed `bonded_tokens` and `not_bonded_tokens` type inside `staking_pool` table to `TEXT` to avoid value overflow
- ([\#275](https://github.com/forbole/callisto/pull/275)) Added `tombstoned` column inside `validator_status` table
- ([\#232](https://github.com/forbole/callisto/pull/232)) Added `vesting_account` and `vesting_period` table
- ([\#276](https://github.com/forbole/callisto/pull/276)) Added `fee_grant_allowance` table (v0.44.x)

#### Modules
- ([\#353](https://github.com/forbole/callisto/pull/353)) Removed the support for the `history` module
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
###############################################################
### STAGE 1: Build BDJuno pre-requisites ###
### STAGE 1: Build Callisto pre-requisites ###
###############################################################

FROM golang:1.18-alpine AS builder
FROM golang:1.20-alpine AS builder

RUN apk update && apk add --no-cache make git bash

WORKDIR /go/src/github.com/forbole/bdjuno
WORKDIR /go/src/github.com/forbole/callisto
COPY . ./

######################################################
Expand All @@ -30,10 +30,10 @@ RUN go mod download && make build


###############################################################
### STAGE 2: Copy chain-specific BDJuno config ###
### STAGE 2: Copy chain-specific Callisto config ###
###############################################################

FROM alpine:3.17 AS bdjuno
FROM alpine:3.19 AS callisto

##################################################
## Enabe line below if chain supports cosmwasm ##
Expand All @@ -42,12 +42,12 @@ FROM alpine:3.17 AS bdjuno
#RUN apk update && apk add --no-cache ca-certificates build-base
RUN apk update && apk add --no-cache bash ca-certificates curl

# Copy BDJuno binary
COPY --from=builder /go/src/github.com/forbole/bdjuno/build/bdjuno /usr/local/bin/bdjuno
# Copy Callisto binary
COPY --from=builder /go/src/github.com/forbole/callisto/build/callisto /usr/local/bin/callisto

# Set user directory and details
ARG HOME_DIR="/bdjuno"
ARG USER="bdjuno"
ARG HOME_DIR="/callisto"
ARG USER="callisto"
SHELL ["/bin/sh", "-euo", "pipefail", "-c"]

# Add non-root user to use in the container
Expand All @@ -59,7 +59,7 @@ WORKDIR $HOME_DIR
USER $USER

# Copy chain-specific config file from Git repo
COPY --chown=$USER:$USER deploy/ .bdjuno/
RUN mv .bdjuno/entrypoint.sh . && chmod +x entrypoint.sh
COPY --chown=$USER:$USER deploy/ .callisto/
RUN mv .callisto/entrypoint.sh . && chmod +x entrypoint.sh

ENTRYPOINT [ "/bdjuno/entrypoint.sh" ]
ENTRYPOINT [ "/callisto/entrypoint.sh" ]
21 changes: 21 additions & 0 deletions Dockerfile.cosmwasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# hadolint global ignore=DL3018,DL4006,SC2046,DL3059,DL3007
FROM golang:1.20-alpine AS builder
RUN apk update && apk add --no-cache make git
WORKDIR /go/src/github.com/forbole/callisto
COPY . ./

RUN apk update && apk add --no-cache ca-certificates build-base git
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 9ecb037336bd56076573dc18c26631a9d2099a7f2b40dc04b6cae31ffb4c8f9a
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 6e4de7ba9bad4ae9679c7f9ecf7e283dd0160e71567c6a7be6ae47c81ebe7f32
## Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a
RUN go mod download
RUN LINK_STATICALLY=true BUILD_TAGS="muslc" make build

FROM alpine:latest
RUN apk update && apk add --no-cache ca-certificates build-base
WORKDIR /callisto
COPY --from=builder /go/src/github.com/forbole/callisto/build/callisto /usr/bin/callisto
CMD [ "callisto" ]
11 changes: 11 additions & 0 deletions Dockerfile.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.20-alpine AS builder
RUN apk update && apk add --no-cache make git
WORKDIR /go/src/github.com/forbole/callisto
COPY . ./
RUN go mod download
RUN make build

FROM alpine:latest
WORKDIR /callisto
COPY --from=builder /go/src/github.com/forbole/callisto/build/callisto /usr/bin/callisto
CMD [ "callisto" ]
Loading

0 comments on commit de4cfdd

Please sign in to comment.