Skip to content

Commit

Permalink
Fix cosmossdk version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Feb 20, 2024
1 parent e24a4b5 commit e572ccd
Showing 1 changed file with 44 additions and 18 deletions.
62 changes: 44 additions & 18 deletions indexer/src/providers/providerStatusProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ export async function syncProvidersInfo() {
timeout: StatusCallTimeout
});

const versionStr = semver.valid(versionResponse.data.akash.version);
const akashVersion = semver.valid(versionResponse.data.akash.version);
const cosmosVersion = semver.valid(
"cosmosSdkVersion" in versionResponse.data.akash ? versionResponse.data.akash.cosmosSdkVersion : versionResponse.data.akash.cosmos_sdk_version
);

if (versionStr && semver.gte(versionStr, "0.5.0-0")) {
await grpcFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout);
if (akashVersion && semver.gte(akashVersion, "0.5.0-0")) {
await grpcFetchAndSaveProviderStats(provider, cosmosVersion, akashVersion, StatusCallTimeout);
} else {
await restFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout);
await restFetchAndSaveProviderStats(provider, cosmosVersion, akashVersion, StatusCallTimeout);
}
} catch (err) {
const checkDate = new Date();
Expand Down Expand Up @@ -88,17 +91,40 @@ export async function syncProvidersInfo() {
console.log("Finished refreshing provider infos");
}

type ProviderVersionEndpointResponseType = {
akash: { version: string; commit: string; buildTags: string; go: string; cosmosSdkVersion: string };
kube: {
major: string;
minor: string;
gitVersion: string;
gitCommit: string;
gitTreeState: string;
buildDate: string;
goVersion: string;
compiler: string;
platform: string;
};
};
type ProviderVersionEndpointResponseType =
| {
akash: { version: string; commit: string; buildTags: string; go: string; cosmosSdkVersion: string };
kube: {
major: string;
minor: string;
gitVersion: string;
gitCommit: string;
gitTreeState: string;
buildDate: string;
goVersion: string;
compiler: string;
platform: string;
};
}
| {
akash: {
name: string;
server_name: string;
version: string;
commit: string;
build_tags: string;
go: string;
cosmos_sdk_version: string;
};
kube: {
major: string;
minor: string;
gitVersion: string;
gitCommit: string;
gitTreeState: string;
buildDate: string;
goVersion: string;
compiler: string;
platform: string;
};
};

0 comments on commit e572ccd

Please sign in to comment.