Skip to content

Commit

Permalink
Fix error and sync with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
filipdjokic committed Apr 9, 2024
1 parent c2ed3b5 commit 425c197
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 49 deletions.
20 changes: 10 additions & 10 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

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 @@ -33,7 +33,7 @@ RUN go mod download && make build
### STAGE 2: Copy chain-specific BDJuno config ###
###############################################################

FROM alpine:3.17 AS bdjuno
FROM alpine:3.17 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" ]
31 changes: 0 additions & 31 deletions cmd/bdjuno/cheqd.go

This file was deleted.

4 changes: 1 addition & 3 deletions cmd/callisto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"github.com/cheqd/cheqd-node/app"

Check failure on line 4 in cmd/callisto/main.go

View workflow job for this annotation

GitHub Actions / Unit-tests

github.com/cheqd/cheqd-node/[email protected]: missing go.sum entry for go.mod file; to add it:

"github.com/cosmos/cosmos-sdk/types/module"
"github.com/forbole/juno/v5/cmd"
initcmd "github.com/forbole/juno/v5/cmd/init"
Expand Down Expand Up @@ -63,9 +64,6 @@ func getBasicManagers() []module.BasicManager {
// This should be edited by custom implementations if needed.
func getAddressesParser() messages.MessageAddressesParser {
return messages.JoinMessageParsers(
// this is needed so that bdjuno can parse our custom messages properly
// https://docs.bigdipper.live/cosmos-based/parser/custom-chains#optional-add-your-custom-addresses-parser
CheqdAddressesParser,
messages.CosmosMessageAddressesParser,
)
}
2 changes: 1 addition & 1 deletion database/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ VALUES `

stmt += fmt.Sprintf("($%d,$%d,$%d,$%d,$%d,$%d),", si+1, si+2, si+3, si+4, si+5, si+6)
args = append(args,
snapshot.ProposalID, snapshot.ValidatorConsAddress, snapshot.ValidatorVotingPower.String(),
snapshot.ProposalID, snapshot.ValidatorConsAddress, snapshot.ValidatorVotingPower,
snapshot.ValidatorStatus, snapshot.ValidatorJailed, snapshot.Height)
}

Expand Down
1 change: 0 additions & 1 deletion database/types/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ func NewProposalStakingPoolSnapshotRow(proposalID uint64, bondedTokens, notBonde
// --------------------------------------------------------------------------------------------------------------------

type ProposalValidatorVotingPowerSnapshotRow struct {
ValidatorAddress string `db:"validator_address"`
ID int64 `db:"id"`
ProposalID int64 `db:"proposal_id"`
ValidatorAddress string `db:"validator_address"`
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
cosmossdk.io/math v1.3.0
github.com/cheqd/cheqd-node v1.4.4
github.com/cheqd/cheqd-node/v2 v2.0.0-develop.10
github.com/cometbft/cometbft v0.37.4
github.com/cosmos/cosmos-sdk v0.47.10
github.com/cosmos/gogoproto v1.4.11
Expand Down
2 changes: 1 addition & 1 deletion modules/staking/utils_redelegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/forbole/bdjuno/v4/types"
"github.com/forbole/callisto/v4/types"
"github.com/rs/zerolog/log"
)

Expand Down
12 changes: 11 additions & 1 deletion modules/staking/utils_validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
tmctypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/forbole/callisto/v4/modules/staking/keybase"
"github.com/forbole/callisto/v4/types"
juno "github.com/forbole/juno/v5/types"

"github.com/rs/zerolog/log"

Expand Down Expand Up @@ -139,7 +140,7 @@ func (m *Module) GetValidatorsWithStatus(height int64, status string) ([]staking
return nil, nil, err
}

vals := make([]types.Validator, len(validators))
var vals = make([]types.Validator, len(validators))
for index, val := range validators {
validator, err := m.convertValidator(height, val)
if err != nil {
Expand Down Expand Up @@ -334,6 +335,15 @@ func (m *Module) GetValidatorsVotingPowers(height int64, vals *tmctypes.ResultVa
return nil, err
}

// Find the voting power of this validator
var votingPower int64 = 0
for _, blockVal := range vals.Validators {
blockValConsAddr := juno.ConvertValidatorAddressToBech32String(blockVal.Address)
if blockValConsAddr == consAddr.String() {
votingPower = blockVal.VotingPower
}
}

if found, _ := m.db.HasValidator(consAddr.String()); !found {
continue
}
Expand Down

0 comments on commit 425c197

Please sign in to comment.