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

Conversation

DavidVentura
Copy link
Contributor

Need to clean up hacks & verify tests, but in practice it's working

@mkaczanowski
Copy link
Contributor

but in practice it's working

It would be nice to have explanation in the code (some comment) why this is needed and why parsing raw json (which may or may not be compatible with the hand made struct - reponses can change through versions).

Also I don't think it is the best option to switch every network to use json parsing rather than upstream client, just because "bera" is special. I would in fact, leave everything as is and add json parsing for the networks that are "special" (like bera).

@@ -36,9 +36,13 @@ func (d *Daemon) preUpgradeChecks(

// notify once about the upcoming upgrade
if currStep == urproto.UpgradeStep_MONITORING {
chainName := "unsupported-name"
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the purpose of that one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't access nodeInfo if there's no gRPC, this dependency is not necessary, as we already ask for a unique network identifier in the config (UpgradeRegistry.Network)

@DavidVentura DavidVentura self-assigned this Feb 27, 2025
@DavidVentura DavidVentura marked this pull request as ready for review February 28, 2025 10:14
@DavidVentura
Copy link
Contributor Author

It would be nice to have explanation in the code (some comment) why this is needed

added an explanation

and why parsing raw json (which may or may not be compatible with the hand made struct - reponses can change through versions).

how would this work though? the current deserialization code is decoding via proto definitions, which also will break if the protocol changes and we don't update it

Copy link
Contributor

@tschuyebuhl tschuyebuhl left a comment

Choose a reason for hiding this comment

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

looks good

Comment on lines 168 to 180
type StatusResponse struct {
Result struct {
ValidatorInfo struct {
Address string `json:"address"`
VotingPower uint64 `json:"voting_power,string"`
} `json:"validator_info"`
NodeInfo struct {
Network string `json:"network"`
} `json:"node_info"`
SyncInfo struct {
LatestBlockTime string `json:"latest_block_time"`
LatestBlockHeight int64 `json:"latest_block_height,string"`
} `json:"sync_info"`
} `json:"result"`
ValidatorInfo struct {
Address string `json:"address"`
VotingPower uint64 `json:"voting_power,string"`
} `json:"validator_info"`
NodeInfo struct {
Network string `json:"network"`
} `json:"node_info"`
SyncInfo struct {
LatestBlockTime string `json:"latest_block_time"`
LatestBlockHeight int64 `json:"latest_block_height,string"`
} `json:"sync_info"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

0/5 i preferred the previous struct layout more because it more closely resembled to what we had in the tmrpc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with the Result wrapper? i removed it because it "leaks" to the caller

i was even thinking of keeping the return value of Status() the same, and casting from this StatusResponse to tm.StatusResponse, so that when we can delete this code, no callers change

Copy link
Contributor

Choose a reason for hiding this comment

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

would the cast work? i think it's very strict, also when it comes to struct tags. if not you can just write a converter function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, i meant a manual "cast"

Copy link
Contributor

Choose a reason for hiding this comment

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

also the converter function may be a little bit more sophisticated to maybe throw errors if we upgrade tendermint lib and it stops working

@@ -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

Comment on lines +144 to +154
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")
}
logger.Infof("Connected to the %s node ID: %s", d.nodeInfo.ApplicationVersion.Name, d.nodeInfo.DefaultNodeInfo.DefaultNodeID)

// if the env prefix is not set, we set it to <APP_NAME>_ (e.g "GAIAD_")
if cfg.Compose.EnvPrefix == "" {
cfg.Compose.EnvPrefix = strings.ToUpper(d.nodeInfo.ApplicationVersion.AppName) + "_"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

i think there were some exceptions to the appname corresponding to the env prefix? onomy?? im not 100% sure, but even it that was the case it's okay for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this code didn't change -- just got indented; maybe it was always wrong?
as i see it: if left blank, take it from grpc. if the grpc value is not useful, provide it in the config.

@DavidVentura
Copy link
Contributor Author

blazar now works with

  • story
  • berachain
  • mezo
  • polygon

though you need both this patch and to disable chain as an upgrade-provider

@DavidVentura DavidVentura merged commit 290d1db into main Feb 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants