Skip to content

Commit

Permalink
changes to the genesis-network.json constructor that resolve the erro…
Browse files Browse the repository at this point in the history
…r's while parsing the json inside the node root containerpull

Signed-off-by: instamenta <[email protected]>
  • Loading branch information
instamenta committed Dec 16, 2024
1 parent 7ec2527 commit 0b2326b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
import type {AccountId} from '@hashgraph/sdk';
import type {AccountId, PublicKey} from '@hashgraph/sdk';
import type {GenesisNetworkNodeStructure, ServiceEndpoint, ToObject} from '../../types/index.js';

export class GenesisNetworkNodeDataWrapper
Expand All @@ -30,7 +30,7 @@ export class GenesisNetworkNodeDataWrapper

constructor(
public readonly nodeId: number,
public readonly adminKey: string,
public readonly adminKey: PublicKey,
public readonly description: string,
) {}

Expand All @@ -39,18 +39,17 @@ export class GenesisNetworkNodeDataWrapper
* @param port
*/
public addServiceEndpoint(domainName: string, port: number): void {
this.serviceEndpoint.push({domainName, port});
this.serviceEndpoint.push({domainName, port, ipAddressV4: ''});
}

/**
* @param domainName - a fully qualified domain name
* @param port
*/
public addGossipEndpoint(domainName: string, port: number): void {
this.gossipEndpoint.push({domainName, port});
this.gossipEndpoint.push({domainName, port, ipAddressV4: ''});
}

// @ts-ignore
public toObject() {
return {
node: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class GenesisNetworkDataConstructor implements ToJSON {
for (const nodeAlias of nodeAliases) {
const nodeId = Templates.nodeIdFromNodeAlias(nodeAlias);
const adminPrivateKey = PrivateKey.fromStringED25519(constants.GENESIS_KEY);
const adminPubKey = adminPrivateKey.publicKey.toStringRaw();
const adminPubKey = adminPrivateKey.publicKey;

this.nodes[nodeAlias] = new GenesisNetworkNodeDataWrapper(nodeId, adminPubKey, nodeAlias);
}
Expand Down Expand Up @@ -69,7 +69,7 @@ export class GenesisNetworkDataConstructor implements ToJSON {
const certPem = nodeKeys.certificate.toString();

//* Assign the PEM certificate
this.nodes[nodeAlias].gossipCaCertificate = certPem;
this.nodes[nodeAlias].gossipCaCertificate = nodeKeys.certificate.toString('base64');

//* Decode the PEM to DER format
const tlsCertDer = new Uint8Array(x509.PemConverter.decode(certPem)[0]);
Expand Down
10 changes: 5 additions & 5 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import type net from 'net';
import type * as WebSocket from 'ws';
import type crypto from 'crypto';
import type {ListrTask, ListrTaskWrapper} from 'listr2';
import type {AccountId} from '@hashgraph/sdk';
import {type JsonString} from './aliases.js';
import type {AccountId, PublicKey} from '@hashgraph/sdk';
import type {JsonString} from './aliases.js';

// NOTE: DO NOT add any Solo imports in this file to avoid circular dependencies

Expand Down Expand Up @@ -98,20 +98,20 @@ export type EmptyContextConfig = object;
export type SoloListrTaskWrapper<T> = ListrTaskWrapper<T, any, any>;

export interface ServiceEndpoint {
ipAddressV4?: Uint8Array;
ipAddressV4?: string;
port: number;
domainName: string;
}

export interface GenesisNetworkNodeStructure {
nodeId: number;
accountId: AccountId | string;
accountId: AccountId;
description: string;
gossipEndpoint: ServiceEndpoint[];
serviceEndpoint: ServiceEndpoint[];
gossipCaCertificate: string;
grpcCertificateHash: string;
weight: number;
deleted: boolean;
adminKey: string;
adminKey: PublicKey;
}
2 changes: 1 addition & 1 deletion version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

export const JAVA_VERSION = '21.0.1+12';
export const HELM_VERSION = 'v3.14.2';
export const SOLO_CHART_VERSION = '0.36.2';
export const SOLO_CHART_VERSION = '0.36.3';
export const HEDERA_PLATFORM_VERSION = 'v0.57.2';
export const MIRROR_NODE_VERSION = '0.118.1';
export const HEDERA_EXPLORER_VERSION = '0.2.1';
Expand Down

0 comments on commit 0b2326b

Please sign in to comment.