Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support chains with no gRPC & with BLS keys #43

Merged
merged 6 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions internal/pkg/cosmos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ func (cc *Client) GetLatestBlockHeight(ctx context.Context) (int64, error) {
if err2 != nil {
return 0, errors.Wrapf(err, "failed to get latest block & status")
}
height, err := strconv.ParseInt(status.Result.SyncInfo.LatestBlockHeight, 10, 64)
if err != nil {
return 0, errors.Wrapf(err, "failed to parse height from status")
}
return height, nil
return status.Result.SyncInfo.LatestBlockHeight, nil
}

if res.SdkBlock != nil {
Expand Down Expand Up @@ -173,14 +169,14 @@ type StatusResponse struct {
Result struct {
ValidatorInfo struct {
Address string `json:"address"`
VotingPower string `json:"voting_power"`
VotingPower uint64 `json:"voting_power,string"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome, thank you

} `json:"validator_info"`
NodeInfo struct {
Network string `json:"network"`
} `json:"node_info"`
SyncInfo struct {
LatestBlockTime string `json:"latest_block_time"`
LatestBlockHeight string `json:"latest_block_height"`
LatestBlockHeight int64 `json:"latest_block_height,string"`
} `json:"sync_info"`
} `json:"result"`
}
Expand Down
12 changes: 9 additions & 3 deletions internal/pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (d *Daemon) Init(ctx context.Context, cfg *config.Config) error {

// display information about the node
if cfg.Compose.EnvPrefix == "" {
// FIXME: this will break checks that look at nodeInfo
logger.Infof("No EnvPrefix found in config, fetching NodeInfo from GRPC")
d.nodeInfo, err = d.cosmosClient.NodeInfo(ctx)
if err != nil {
return errors.Wrapf(err, "failed to get node info")
Expand All @@ -160,15 +160,21 @@ func (d *Daemon) Init(ctx context.Context, cfg *config.Config) error {
return errors.Wrapf(err, "failed to validate docker compose settings")
}

d.currHeight, err = strconv.ParseInt(status.Result.SyncInfo.LatestBlockHeight, 10, 64)
d.currHeight = status.Result.SyncInfo.LatestBlockHeight
logger.Infof("Observed latest block height: %d", d.currHeight)
d.currHeightTime, err = time.Parse(time.RFC3339Nano, status.Result.SyncInfo.LatestBlockTime)
if err != nil {
return errors.Wrapf(err, "failed to parse latest block time from status endpoint")
}
d.startupHeight = d.currHeight

logger.Infof("Observed node address: %s", status.Result.ValidatorInfo.Address)
d.nodeAddress, err = hex.DecodeString(status.Result.ValidatorInfo.Address)
if err != nil {
return errors.Wrapf(err, "failed to parse node address from status endpoint")
}

valVP, err := strconv.ParseInt(status.Result.ValidatorInfo.VotingPower, 10, 64)
valVP := status.Result.ValidatorInfo.VotingPower

// test consensus state endpoint
logger.Info("Attempting to get consensus state")
Expand Down